填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫Home

AnimationEvent

在開始或完成階段呼叫已捕獲動畫的回呼(Callback)時,將此類別的實例作為事件引數返回。

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

呼叫此回呼(Callback)的動畫階段,是 "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.