AnimationPlayer
interface
Provides programmatic control of a reusable animation sequence, built using the build()
method of AnimationBuilder
. The build()
method returns a factory, 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: any): void
getPosition(): number
}
Class implementations
NoopAnimationPlayer
MockAnimationPlayer
See also
AnimationBuilder
AnimationFactory
animate()
Properties
Property | Description |
---|---|
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:
| |||
onDone(fn: () => void): voidParameters
Returns
|
onStart() | |||
---|---|---|---|
Provides a callback to invoke when the animation starts. See also:
| |||
onStart(fn: () => void): voidParameters
Returns
|
onDestroy() | |||
---|---|---|---|
Provides a callback to invoke after the animation is destroyed. See also:
| |||
onDestroy(fn: () => void): voidParameters
Returns
|
init() |
---|
Initializes the animation. |
init(): voidParametersThere are no parameters. Returns
|
hasStarted() |
---|
Reports whether the animation has started. |
hasStarted(): booleanParametersThere are no parameters. Returns
|
play() |
---|
Runs the animation, invoking the onStart() callback.
|
play(): voidParametersThere are no parameters. Returns
|
pause() |
---|
Pauses the animation. |
pause(): voidParametersThere are no parameters. Returns
|
restart() |
---|
Restarts the paused animation. |
restart(): voidParametersThere are no parameters. Returns
|
finish() |
---|
Ends the animation, invoking the onDone() callback.
|
finish(): voidParametersThere are no parameters. Returns
|
destroy() |
---|
Destroys the animation, after invoking the beforeDestroy() callback. Calls the onDestroy() callback when destruction is completed.
|
destroy(): voidParametersThere are no parameters. Returns
|
reset() |
---|
Resets the animation to its initial state. |
reset(): voidParametersThere are no parameters. Returns
|
setPosition() | |||
---|---|---|---|
Sets the position of the animation. | |||
setPosition(position: any): voidParameters
Returns
|
getPosition() |
---|
Reports the current position of the animation. |
getPosition(): numberParametersThere are no parameters. Returns
|
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v8.angular.io/api/animations/AnimationPlayer