• Overview
@angular/animations

AnimationPlayer

interface
deprecatedsince v20.2

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.

Deprecation warning

Use animate.enter or animate.leave instead. Intent to remove in v23

API

    
      interface AnimationPlayer {}
    
    

onDone

void

Provides a callback to invoke when the animation finishes.

@paramfn() => void

The callback function.

@returnsvoid

onStart

void

Provides a callback to invoke when the animation starts.

@paramfn() => void

The callback function.

@returnsvoid

onDestroy

void

Provides a callback to invoke after the animation is destroyed.

@paramfn() => void

The callback function.

@returnsvoid

init

void

Initializes the animation.

@returnsvoid

hasStarted

boolean

Reports whether the animation has started.

@returnsboolean

play

void

Runs the animation, invoking the onStart() callback.

@returnsvoid

pause

void

Pauses the animation.

@returnsvoid

restart

void

Restarts the paused animation.

@returnsvoid

finish

void

Ends the animation, invoking the onDone() callback.

@returnsvoid

destroy

void

Destroys the animation, after invoking the beforeDestroy() callback. Calls the onDestroy() callback when destruction is completed.

@returnsvoid

reset

void

Resets the animation to its initial state.

@returnsvoid

setPosition

void

Sets the position of the animation.

@parampositionnumber

A fractional value, representing the progress through the animation.

@returnsvoid

getPosition

number

Reports the current position of the animation.

@returnsnumber

parentPlayer

AnimationPlayer | null

The parent of this player, if any.

totalTime

number

The total run time of the animation, in milliseconds.

beforeDestroy

(() => any) | undefined

Provides a callback to invoke before the animation is destroyed.

Jump to details