animate
Commons
stable
Safe wrapper around the Web Animations API. Falls back to a resolved-promise stub when the browser does not support Element.animate() or when an exception is thrown.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- elrequisElement
- The DOM element to animate.
- keyframesrequisArray<Keyframe> | PropertyIndexedKeyframes | null
- Keyframe descriptors in WAAPI format — either an array of Keyframe objects or a property-indexed object.
- optionsnumber | KeyframeAnimationOptions
- Duration in milliseconds (number) or a full KeyframeAnimationOptions object controlling easing, delay, fill, etc.
API
Valeur de retour
La valeur retournée par cet util.
- The native Animation object, or a stub with a resolved finished promise when the API is unavailable.
Usage
Exemples
Extraits de code prêts à coller.
Fade-in an element