填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

AnimationPlayer

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
}
    

参见

属性

属性说明
parentPlayer: AnimationPlayer | null

The parent of this player, if any.

totalTime: number只读

The total run time of the animation, in milliseconds.

beforeDestroy?: () => any

Provides a callback to invoke before the animation is destroyed.

方法

Provides a callback to invoke when the animation finishes.

See also:

  • finish()

onDone(fn: () => void): void
      
      onDone(fn: () => void): void
    
参数
fn () => void

The callback function.

返回值

void

Provides a callback to invoke when the animation starts.

See also:

  • run()

onStart(fn: () => void): void
      
      onStart(fn: () => void): void
    
参数
fn () => void

The callback function.

返回值

void

Provides a callback to invoke after the animation is destroyed.

See also:

  • destroy()

  • beforeDestroy()

onDestroy(fn: () => void): void
      
      onDestroy(fn: () => void): void
    
参数
fn () => void

The callback function.

返回值

void

Initializes the animation.

init(): void
      
      init(): void
    
参数

没有参数。

返回值

void

Reports whether the animation has started.

hasStarted(): boolean
      
      hasStarted(): boolean
    
参数

没有参数。

返回值

boolean: True if the animation has started, false otherwise.

Runs the animation, invoking the onStart() callback.

play(): void
      
      play(): void
    
参数

没有参数。

返回值

void

Pauses the animation.

pause(): void
      
      pause(): void
    
参数

没有参数。

返回值

void

Restarts the paused animation.

restart(): void
      
      restart(): void
    
参数

没有参数。

返回值

void

Ends the animation, invoking the onDone() callback.

finish(): void
      
      finish(): void
    
参数

没有参数。

返回值

void

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

destroy(): void
      
      destroy(): void
    
参数

没有参数。

返回值

void

Resets the animation to its initial state.

reset(): void
      
      reset(): void
    
参数

没有参数。

返回值

void

Sets the position of the animation.

setPosition(position: any): void
      
      setPosition(position: any): void
    
参数
position any

A 0-based offset into the duration, in milliseconds.

返回值

void

Reports the current position of the animation.

getPosition(): number
      
      getPosition(): number
    
参数

没有参数。

返回值

number: A 0-based offset into the duration, in milliseconds.