https://github.com/angular/angular
Raw File
Tip revision: e3f09ce845cef9fd2c89d39d0d822114c51e68fa authored by Alex Rickabaugh on 10 February 2021, 22:04:14 UTC
release: cut the v11.2.0 release (#40790)
Tip revision: e3f09ce
animation_event.ts
/**
 * @license
 * Copyright Google LLC All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */

/**
 * 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.
 *
 * ```typescript
 * @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
 *   }
 * }
 * ```
 *
 * @publicApi
 */
export interface AnimationEvent {
  /**
   * The name of the state from which the animation is triggered.
   */
  fromState: string;
  /**
   * The name of the state in which the animation completes.
   */
  toState: string;
  /**
   * The time it takes the animation to complete, in milliseconds.
   */
  totalTime: number;
  /**
   * The animation phase in which the callback was invoked, one of
   * "start" or "done".
   */
  phaseName: string;
  /**
   * The element to which the animation is attached.
   */
  element: any;
  /**
   * Internal.
   */
  triggerName: string;
  /**
   * Internal.
   */
  disabled: boolean;
}
back to top