AnimationPlayer
Provides programmatic control of a reusable animation sequence,
built using the AnimationBuilder.build()
method which returns an AnimationFactory
, whose
create()
method instantiates and
initializes this interface.
interface AnimationPlayer {
parentPlayer: AnimationPlayer | null
totalTime: number
beforeDestroy?: () => any
onDone(fn: () => void): void
onStart(fn: () => void): void
onDestroy(fn: () => void): void
init(): void
hasStarted(): boolean
play(): void
pause(): void
restart(): void
finish(): void
destroy(): void
reset(): void
setPosition(position: number): void
getPosition(): number
}
Class implementations
See also
Properties
Property | Description |
---|---|
parentPlayer: AnimationPlayer | null
|
The parent of this player, if any. |
totalTime: number
|
Read-Only
The total run time of the animation, in milliseconds. |
beforeDestroy?: () => any
|
Provides a callback to invoke before the animation is destroyed. |
Methods
onDone() |
---|
Provides a callback to invoke when the animation finishes. See also: |
onStart() |
---|
Provides a callback to invoke when the animation starts. See also: |
onDestroy() |
---|
Provides a callback to invoke after the animation is destroyed. See also: |
init() |
---|
Initializes the animation. |
ParametersThere are no parameters. Returns
|
hasStarted() |
---|
Reports whether the animation has started. |
ParametersThere are no parameters. Returns
|
play() |
---|
Runs the animation, invoking the |
ParametersThere are no parameters. Returns
|
pause() |
---|
Pauses the animation. |
ParametersThere are no parameters. Returns
|
restart() |
---|
Restarts the paused animation. |
ParametersThere are no parameters. Returns
|
finish() |
---|
Ends the animation, invoking the |
ParametersThere are no parameters. Returns
|
destroy() |
---|
Destroys the animation, after invoking the |
ParametersThere are no parameters. Returns
|
reset() |
---|
Resets the animation to its initial state. |
ParametersThere are no parameters. Returns
|
setPosition() |
---|
Sets the position of the animation. |
getPosition() |
---|
Reports the current position of the animation. |
ParametersThere are no parameters. Returns
|