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

AnimationEvent

在开始或完成阶段调用已捕获动画的回调时,将此类的实例作为事件参数返回。

An instance of this class is returned as an event parameter when an animation callback is captured for an animation either during the start or done phase.

查看"说明"...

      
      interface AnimationEvent {
  fromState: string
  toState: string
  totalTime: number
  phaseName: string
  element: any
  triggerName: string
  disabled: boolean
}
    

说明

      
      @Component({
  host: {
    '[@myAnimationTrigger]': 'someExpression',
    '(@myAnimationTrigger.start)': 'captureStartEvent($event)',
    '(@myAnimationTrigger.done)': 'captureDoneEvent($event)',
  },
  animations: [
    trigger("myAnimationTrigger", [
       // ...
    ])
  ]
})
class MyComponent {
  someExpression: any = false;
  captureStartEvent(event: AnimationEvent) {
    // the toState, fromState and totalTime data is accessible from the event variable
  }

  captureDoneEvent(event: AnimationEvent) {
    // the toState, fromState and totalTime data is accessible from the event variable
  }
}
    

属性

属性说明
fromState: string

触发动画的状态的名称。

The name of the state from which the animation is triggered.

toState: string

动画完成状态的名称。

The name of the state in which the animation completes.

totalTime: number

动画完成所花费的时间(以毫秒为单位)。

The time it takes the animation to complete, in milliseconds.

phaseName: string

调用此回调的动画阶段,是 "start" 或 "done" 之一。

The animation phase in which the callback was invoked, one of "start" or "done".

element: any

动画附加到的元素。

The element to which the animation is attached.

triggerName: string

内部。

Internal.

disabled: boolean

内部。

Internal.