Baseline Widely available
The Animation()
constructor of the Web Animations API returns a new Animation
object instance.
new Animation()
new Animation(effect)
new Animation(effect, timeline)
Parameters
effect
Optional
The target effect, as an object based on the AnimationEffect
interface, to assign to the animation. Although in the future other effects such as SequenceEffect
s or GroupEffect
s might be possible, the only kind of effect currently available is KeyframeEffect
. This can be null
(which is the default) to indicate that there should be no effect applied.
timeline
Optional
Specifies the timeline
with which to associate the animation, as an object of a type based on the AnimationTimeline
interface. The default value is Document.timeline
, but this can be set to null
as well.
In the Follow the White Rabbit example, the Animation()
constructor is used to create an Animation
for the rabbitDownKeyframes
using the document's timeline
:
const rabbitDownAnimation = new Animation(
rabbitDownKeyframes,
document.timeline,
);
Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3