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
}
}