Use animate()
to set a CSS Animation on UI elements.
An object that contains one or more properties:
Key | Value Type | Optional | Description | Default Value |
---|---|---|---|---|
duration | Number | optional | The length of time for the animation to run. | 0 |
delay | Number | optional | The length of time to wait before starting the animation. | 0 |
iterations | Number | optional | The number of times the animation should repeat. You can set this to Infinity to make the animation loop indefinitely. | 1 |
direction | String | optional | Whether the animation runs forwards (normal ), backwards (reverse ), switches direction after each iteration (alternate ), or runs backwards and switches direction after each iteration (alternate-reverse ). Defaults to "normal" . | "normal" |
easing | String | optional | The rate of the animation's change over time. Accepts an timing-function, such as "linear" , "ease-in" , or "cubic-bezier(0.42, 0, 0.58, 1)" . Defaults to "linear". | "linear" |
fill | String | optional | Dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. Defaults to "none". | "none" |
name | String | optional | The name of the animation, which can be used to uniquely identify it. This name appears in the animation events parameters and is typically used to determine if a particular animation event is the one you're interested in. | An internal unique ID. |
play-state | String | optional | Animation motion state, which defines whether an animation is running or paused, accepts an animation-play-state | running |
If no name
is specified, a unique id is generated incrementally.
Returns an Animation
object.
The Animation
object has the following methods:
Method Name | Description |
---|---|
Animation.cancel() | Cancels the animation and triggers the animation cancel event. |
Animation.pause() | Pauses the animation. |
Animation.play() | Resumes the animation. |
The events for the animate()
API are the same as the animation events for CSS animations.
LCD tables only load in the browser