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 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 |
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 cancel event. |
Animation.pause() | Pauses the animation. |
Animation.play() | Resumes the animation. |
getElementById("test").animate will generate a new Animation object, and the later created animation will override the previous ones.getElementById("test").animate again to create a new Animation object.After Lynx version 3.4, the animate() can be called via the createSelectorQuery().
It's an experimental feature, and you should use it with caution.
After Lynx version 3.4, you can chain multiple animation with createSelectorQuery().
It's an experimental feature, and you should use it with caution.
The events for the animate() API are the same as the animation events for CSS animations.
Animate Api and CSS Animation will override each other, and the one that takes effect later will override the former.
The Animate API may not take effect, possibly because getElementById failed to select the node:
LCD tables only load in the browser