On this page
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
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.  | 
      ||
  | 
      
| fn | The callback function.  | 
          
Returns
void
| 
         
          onStart() 
          | 
      ||
|---|---|---|
Provides a callback to invoke when the animation starts.  | 
      ||
  | 
      
| fn | The callback function.  | 
          
Returns
void
| 
         
          onDestroy() 
          | 
      ||
|---|---|---|
Provides a callback to invoke after the animation is destroyed.  | 
      ||
  | 
      
| fn | The callback function.  | 
          
Returns
void
| 
         
          init() 
          | 
      
|---|
Initializes the animation.  | 
      
  | 
      
| 
         
          hasStarted() 
          | 
      
|---|
Reports whether the animation has started.  | 
      
  | 
      
| 
         
          play() 
          | 
      
|---|
Runs the animation, invoking the   | 
      
  | 
      
| 
         
          pause() 
          | 
      
|---|
Pauses the animation.  | 
      
  | 
      
| 
         
          restart() 
          | 
      
|---|
Restarts the paused animation.  | 
      
  | 
      
| 
         
          finish() 
          | 
      
|---|
Ends the animation, invoking the   | 
      
  | 
      
| 
         
          destroy() 
          | 
      
|---|
Destroys the animation, after invoking the   | 
      
  | 
      
| 
         
          reset() 
          | 
      
|---|
Resets the animation to its initial state.  | 
      
  | 
      
| 
         
          setPosition() 
          | 
      ||
|---|---|---|
Sets the position of the animation.  | 
      ||
  | 
      
| position | A 0-based offset into the duration, in milliseconds.  | 
          
Returns
void
| 
         
          getPosition() 
          | 
      
|---|
Reports the current position of the animation.  | 
      
  | 
      
© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
 https://v6.angular.io/api/animations/AnimationPlayer