{ "id": "api/animations/AnimationEvent", "title": "AnimationEvent", "contents": "\n\n
\n
\n
\n \n API > @angular/animations\n
\n \n
\n \n
\n

AnimationEventlink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

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

\n\n

See more...

\n
\n \n \n
\n\ninterface AnimationEvent {\n fromState: string\n toState: string\n totalTime: number\n phaseName: string\n element: any\n triggerName: string\n disabled: boolean\n}\n\n\n \n \n\n\n \n \n\n
\n\n \n\n \n \n
\n

Descriptionlink

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

Propertieslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
PropertyDescription
\n \n fromState: string\n \n \n

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

\n\n \n
\n \n toState: string\n \n \n

The name of the state in which the animation completes.

\n\n \n
\n \n totalTime: number\n \n \n

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

\n\n \n
\n \n phaseName: string\n \n \n

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

\n\n \n
\n \n element: any\n \n \n

The element to which the animation is attached.

\n\n \n
\n \n triggerName: string\n \n \n

Internal.

\n\n \n
\n \n disabled: boolean\n \n \n

Internal.

\n\n \n
\n
\n \n\n\n \n\n\n
\n
\n\n\n" }