Use animate() to set a CSS Animation on UI elements.
Element object that needs to be animated based on its id.animate API on the Element object to achieve animation.There are two different formats:
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 Infinityto 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 | 
name is specified, a unique id is generated incrementally.name cannot be triggered consecutively multiple times.Returns an Animation object.
The Animation object has the following methods:
| Method Name | Description | 
|---|---|
| Animation.cancel() | Cancels the animation and triggers the animation cancelevent. | 
| 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.
getElementById("test").animate will generate a new Animation object.getElementById("test").animate is called multiple times for a node, the last created animation will overwrite the previous animation.Animation object ends, if you want to restart the same animation, you need to call getElementById("test").animate again to create a new Animation object.The Animate API may not take effect, possibly because getElementById failed to select the node:
LCD tables only load in the browser