The Animation interface of the Web Animations API represents a single animation player and provides playback controls and a timeline for an animation node or source.

Documentation Animation by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Constructor

new(?effect:AnimationEffect, ?timeline:AnimationTimeline)

Throws:

null

DOMError

Variables

currentTime:Float

The current time value of the animation in milliseconds, whether running or paused. If the animation lacks a AnimationTimeline, is inactive or hasn't been played yet, its value is null.

effect:AnimationEffect

Gets and sets the AnimationEffectReadOnly associated with this animation. This will usually be a KeyframeEffect object.

read onlyfinished:Promise<Animation>

Returns the current finished Promise for this animation.

id:String

Gets and sets the String used to identify the animation.

oncancel:Function

Gets and sets the event handler for the cancel event.

onfinish:Function

Gets and sets the event handler for the finish event.

read onlypending:Bool

Indicates whether the animation is currently waiting for an asynchronous operation such as initiating playback or pausing a running animation.

read onlyplayState:AnimationPlayState

Returns an enumerated value describing the playback state of an animation.

playbackRate:Float

Gets or sets the playback rate of the animation.

read onlyready:Promise<Animation>

Returns the current ready Promise for this animation.

startTime:Float

Gets or sets the scheduled time when an animation's playback should begin.

timeline:AnimationTimeline

Gets or sets the AnimationTimeline associated with this animation.

Methods

cancel():Void

Clears all KeyframeEffect caused by this animation and aborts its playback.

finish():Void

Seeks either end of an animation, depending on whether the animation is playing or reversing.

Throws:

null

DOMError

pause():Void

Suspends playing of an animation.

Throws:

null

DOMError

play():Void

Starts or resumes playing of an animation, or begins the animation again if it previously finished.

Throws:

null

DOMError

reverse():Void

Reverses playback direction, stopping at the start of the animation. If the animation is finished or unplayed, it will play from end to beginning.

Throws:

null

DOMError

updatePlaybackRate(playbackRate:Float):Void

Sets the speed of an animation after first synchronizing its playback position.

Inherited Variables

Inherited Methods

Defined by EventTarget

addEventListener(type:String, listener:Function, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

addEventListener(type:String, listener:EventListener, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

Register an event handler of a specific event type on the EventTarget.

Throws:

null

DOMError

dispatchEvent(event:Event):Bool

Dispatch an event to this EventTarget.

Throws:

null

DOMError

removeEventListener(type:String, listener:Function, ?options:EitherType<EventListenerOptions, Bool>):Void

removeEventListener(type:String, listener:EventListener, ?options:EitherType<EventListenerOptions, Bool>):Void

Removes an event listener from the EventTarget.

Throws:

null

DOMError