Skip to content

Animation

Type class

An animation of a setting, returned by animate(). It can be paused, resumed, stopped or waited for.

More info: Animations

Sources

This information about Animation is provided for reference only and is not available through exported packages and thus should not be imported or used on its own.

Inheritance

Animation does not extend any other symbol.

Animation is not extended by any other symbol.

Properties

events

Type EventDispatcherDefault new EventDispatcher()

from

Type Value

The value the animation starts from.

percentage

Type Time

How far the current loop has played, from 0 to 1, before easing.

playing

Type boolean

true while the animation plays, false when it is paused or stopped.

stopped

Type boolean

true once the animation has stopped. A stopped animation can't be played again.

to

Type Value

The value the animation goes to.

Methods

constructor(animation: IStartAnimation,
from: Value,
to: Value,
duration: number,
easing: $ease.Easing,
loops: number,
startingTime: number | null
)

Returns Animation

pause()

Returns void

Pauses the animation; play() resumes it.

play()

Returns void

Resumes a paused animation.

stop()

Returns void

Stops the animation, leaving the setting at its current value.

waitForStop()

Returns Promise

Returns a promise that resolves when the animation stops.

Events

Add event handlers to Animation object using its events.on() method. Read about adding event handlers.

stopped

Param { type: "stopped", target: Animation }

The animation stopped: it reached the end, stop() was called, or the same setting was set, removed or animated again.