# Animation [component-header:sl-animation] Animate elements declaratively with over 500 baked-in presets, or roll your own with custom keyframes. Powered by the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API). To animate an element, wrap it in `` and set a `name` and `duration`. ```html preview
``` ?> The animation will only be applied to the first child element found in ``. ## Examples ### Animations & Easings This example demonstrates all of the baked-in animations and easings. All animations were generated based on the popular [Animate.css](https://animate.style/) and [Animista](https://animista.net/) projects. ```html preview
``` ### Using Intersection Observer Use an [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) to control the animation when an element enters or exits the viewport. For example, scroll the box below in and out of your screen. The animation stops when the box exits the viewport and restarts each time it enters the viewport. ```html preview
``` ### Custom Keyframe Formats Supply your own [keyframe formats](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Keyframe_Formats) to build custom animations. ```html preview
``` [component-metadata:sl-animation]