1 | /**
|
---|
2 | * An injectable service that produces an animation sequence programmatically within an
|
---|
3 | * Angular component or directive.
|
---|
4 | * Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`.
|
---|
5 | *
|
---|
6 | * @usageNotes
|
---|
7 | *
|
---|
8 | * To use this service, add it to your component or directive as a dependency.
|
---|
9 | * The service is instantiated along with your component.
|
---|
10 | *
|
---|
11 | * Apps do not typically need to create their own animation players, but if you
|
---|
12 | * do need to, follow these steps:
|
---|
13 | *
|
---|
14 | * 1. Use the `build()` method to create a programmatic animation using the
|
---|
15 | * `animate()` function. The method returns an `AnimationFactory` instance.
|
---|
16 | *
|
---|
17 | * 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element.
|
---|
18 | *
|
---|
19 | * 3. Use the player object to control the animation programmatically.
|
---|
20 | *
|
---|
21 | * For example:
|
---|
22 | *
|
---|
23 | * ```ts
|
---|
24 | * // import the service from BrowserAnimationsModule
|
---|
25 | * import {AnimationBuilder} from '@angular/animations';
|
---|
26 | * // require the service as a dependency
|
---|
27 | * class MyCmp {
|
---|
28 | * constructor(private _builder: AnimationBuilder) {}
|
---|
29 | *
|
---|
30 | * makeAnimation(element: any) {
|
---|
31 | * // first define a reusable animation
|
---|
32 | * const myAnimation = this._builder.build([
|
---|
33 | * style({ width: 0 }),
|
---|
34 | * animate(1000, style({ width: '100px' }))
|
---|
35 | * ]);
|
---|
36 | *
|
---|
37 | * // use the returned factory object to create a player
|
---|
38 | * const player = myAnimation.create(element);
|
---|
39 | *
|
---|
40 | * player.play();
|
---|
41 | * }
|
---|
42 | * }
|
---|
43 | * ```
|
---|
44 | *
|
---|
45 | * @publicApi
|
---|
46 | */
|
---|
47 | export class AnimationBuilder {
|
---|
48 | }
|
---|
49 | /**
|
---|
50 | * A factory object returned from the `AnimationBuilder`.`build()` method.
|
---|
51 | *
|
---|
52 | * @publicApi
|
---|
53 | */
|
---|
54 | export class AnimationFactory {
|
---|
55 | }
|
---|
56 | //# sourceMappingURL=data:application/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