# class Animation

#### package js.html

#### extends EventTarget

Available on HTML5

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:

https://developer.mozilla.org/en-US/docs/Web/API/Animation

### Constructor

###

`new (?effect:KeyframeEffectReadOnly, ?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`.

###

`read onlyeffect:AnimationEffectReadOnly`

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 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.

###

`read onlytimeline: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`

Throws:

`null` | DOMError

###

`pause ():Void`

Throws:

`null` | DOMError

###

`play ():Void`

Throws:

`null` | DOMError

###

`reverse ():Void`

Throws:

`null` | DOMError

### Inherited Variables

### Inherited Methods

#### Defined by EventTarget

###

`addEventListener (type:String, listener:Function, capture:Bool = false):Void`

`addEventListener (type:String, listener:EventListener, capture:Bool = false, ?wantsUntrusted:Bool):Void`

Throws:

`null` | DOMError

###

`dispatchEvent (event:Event):Bool`

Throws:

`null` | DOMError

###

`removeEventListener (type:String, listener:Function, capture:Bool = false):Void`

`removeEventListener (type:String, listener:EventListener, capture:Bool = false):Void`

Throws:

`null` | DOMError