@angular/animations 6.0.3 → 6.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/browser.metadata.json +1 -1
- package/browser/src/dsl/animation_transition_factory.d.ts +1 -1
- package/browser/src/render/animation_engine_next.d.ts +2 -1
- package/browser/src/render/shared.d.ts +2 -0
- package/browser/src/render/timeline_animation_engine.d.ts +2 -1
- package/browser/src/render/transition_animation_engine.d.ts +3 -3
- package/browser/testing.d.ts +0 -5
- package/browser/testing.metadata.json +1 -1
- package/browser.d.ts +0 -5
- package/browser.metadata.json +1 -1
- package/bundles/animations-browser-testing.umd.js +28 -10
- package/bundles/animations-browser-testing.umd.js.map +1 -1
- package/bundles/animations-browser-testing.umd.min.js +16 -2
- package/bundles/animations-browser-testing.umd.min.js.map +1 -1
- package/bundles/animations-browser.umd.js +200 -83
- package/bundles/animations-browser.umd.js.map +1 -1
- package/bundles/animations-browser.umd.min.js +55 -6
- package/bundles/animations-browser.umd.min.js.map +1 -1
- package/bundles/animations.umd.js +470 -577
- package/bundles/animations.umd.js.map +1 -1
- package/bundles/animations.umd.min.js +9 -2
- package/bundles/animations.umd.min.js.map +1 -1
- package/esm2015/animations.externs.js +1 -1
- package/esm2015/browser/browser.externs.js +3 -3
- package/esm2015/browser/src/dsl/animation_transition_factory.js +4 -3
- package/esm2015/browser/src/render/animation_driver.js +1 -12
- package/esm2015/browser/src/render/animation_engine_next.js +8 -4
- package/esm2015/browser/src/render/shared.js +18 -3
- package/esm2015/browser/src/render/timeline_animation_engine.js +6 -2
- package/esm2015/browser/src/render/transition_animation_engine.js +23 -19
- package/esm2015/browser/src/render/web_animations/web_animations_driver.js +3 -3
- package/esm2015/browser/src/util.js +57 -1
- package/esm2015/src/animation_metadata.js +626 -659
- package/esm2015/src/version.js +1 -1
- package/esm5/browser/index.js +5 -1
- package/esm5/browser/public_api.js +6 -1
- package/esm5/browser/src/browser.js +6 -1
- package/esm5/browser/src/dsl/animation.js +1 -1
- package/esm5/browser/src/dsl/animation_ast_builder.js +11 -4
- package/esm5/browser/src/dsl/animation_timeline_builder.js +27 -21
- package/esm5/browser/src/dsl/animation_timeline_instruction.js +1 -1
- package/esm5/browser/src/dsl/animation_transition_expr.js +1 -1
- package/esm5/browser/src/dsl/animation_transition_factory.js +3 -3
- package/esm5/browser/src/dsl/animation_transition_instruction.js +1 -1
- package/esm5/browser/src/dsl/animation_trigger.js +2 -8
- package/esm5/browser/src/dsl/element_instruction_map.js +1 -1
- package/esm5/browser/src/dsl/style_normalization/animation_style_normalizer.js +3 -15
- package/esm5/browser/src/dsl/style_normalization/web_animations_style_normalizer.js +8 -1
- package/esm5/browser/src/private_export.js +8 -1
- package/esm5/browser/src/render/animation_driver.js +8 -3
- package/esm5/browser/src/render/animation_engine_next.js +5 -4
- package/esm5/browser/src/render/css_keyframes/css_keyframes_driver.js +1 -1
- package/esm5/browser/src/render/css_keyframes/css_keyframes_player.js +2 -4
- package/esm5/browser/src/render/css_keyframes/direct_style_player.js +8 -1
- package/esm5/browser/src/render/css_keyframes/element_animation_style_handler.js +1 -1
- package/esm5/browser/src/render/shared.js +19 -3
- package/esm5/browser/src/render/timeline_animation_engine.js +10 -2
- package/esm5/browser/src/render/transition_animation_engine.js +36 -39
- package/esm5/browser/src/render/web_animations/dom_animation.js +1 -1
- package/esm5/browser/src/render/web_animations/web_animations_driver.js +3 -3
- package/esm5/browser/src/render/web_animations/web_animations_player.js +3 -7
- package/esm5/browser/src/util.js +51 -3
- package/esm5/browser/testing/index.js +5 -1
- package/esm5/browser/testing/public_api.js +6 -1
- package/esm5/browser/testing/src/mock_animation_driver.js +12 -17
- package/esm5/browser/testing/src/testing.js +8 -1
- package/esm5/index.js +5 -1
- package/esm5/public_api.js +6 -1
- package/esm5/src/animation_builder.js +3 -93
- package/esm5/src/animation_event.js +1 -1
- package/esm5/src/animation_metadata.js +439 -568
- package/esm5/src/animations.js +6 -1
- package/esm5/src/players/animation_group_player.js +2 -4
- package/esm5/src/players/animation_player.js +11 -14
- package/esm5/src/private_export.js +8 -1
- package/esm5/src/util.js +1 -1
- package/esm5/src/version.js +3 -23
- package/fesm2015/animations.js +446 -631
- package/fesm2015/animations.js.map +1 -1
- package/fesm2015/browser/testing.js +1 -1
- package/fesm2015/browser/testing.js.map +1 -1
- package/fesm2015/browser.js +104 -29
- package/fesm2015/browser.js.map +1 -1
- package/fesm5/animations.js +470 -577
- package/fesm5/animations.js.map +1 -1
- package/fesm5/browser/testing.js +28 -10
- package/fesm5/browser/testing.js.map +1 -1
- package/fesm5/browser.js +200 -83
- package/fesm5/browser.js.map +1 -1
- package/package.json +3 -3
- package/src/animation_metadata.d.ts +673 -650
|
@@ -5,95 +5,180 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* Represents a set of CSS styles for use in an animation style.
|
|
10
|
+
*/
|
|
8
11
|
export interface ɵStyleData {
|
|
9
12
|
[key: string]: string | number;
|
|
10
13
|
}
|
|
11
14
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* @experimental Animation support is experimental.
|
|
16
|
-
*/
|
|
15
|
+
* Represents animation-step timing parameters for an animation step.
|
|
16
|
+
* @see `animate()`
|
|
17
|
+
*/
|
|
17
18
|
export declare type AnimateTimings = {
|
|
19
|
+
/**
|
|
20
|
+
* The full duration of an animation step. A number and optional time unit,
|
|
21
|
+
* such as "1s" or "10ms" for one second and 10 milliseconds, respectively.
|
|
22
|
+
* The default unit is milliseconds.
|
|
23
|
+
*/
|
|
18
24
|
duration: number;
|
|
25
|
+
/**
|
|
26
|
+
* The delay in applying an animation step. A number and optional time unit.
|
|
27
|
+
* The default unit is milliseconds.
|
|
28
|
+
*/
|
|
19
29
|
delay: number;
|
|
30
|
+
/**
|
|
31
|
+
* An easing style that controls how an animations step accelerates
|
|
32
|
+
* and decelerates during its run time. An easing function such as `cubic-bezier()`,
|
|
33
|
+
* or one of the following constants:
|
|
34
|
+
* - `ease-in`
|
|
35
|
+
* - `ease-out`
|
|
36
|
+
* - `ease-in-and-out`
|
|
37
|
+
*/
|
|
20
38
|
easing: string | null;
|
|
21
39
|
};
|
|
22
40
|
/**
|
|
23
|
-
*
|
|
24
|
-
* When options are provided, the delay value of an animation can be changed and animation input
|
|
25
|
-
* parameters can be passed in to change styling and timing data when an animation is started.
|
|
26
|
-
*
|
|
27
|
-
* The following animation DSL functions are able to accept animation option data:
|
|
41
|
+
* @description Options that control animation styling and timing.
|
|
28
42
|
*
|
|
29
|
-
*
|
|
30
|
-
* - {@link sequence sequence()}
|
|
31
|
-
* - {@link group group()}
|
|
32
|
-
* - {@link query query()}
|
|
33
|
-
* - {@link animation animation()}
|
|
34
|
-
* - {@link useAnimation useAnimation()}
|
|
35
|
-
* - {@link animateChild animateChild()}
|
|
43
|
+
* The following animation functions accept `AnimationOptions` data:
|
|
36
44
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
45
|
+
* - `transition()`
|
|
46
|
+
* - `sequence()`
|
|
47
|
+
* - `{@link animations/group group()}`
|
|
48
|
+
* - `query()`
|
|
49
|
+
* - `animation()`
|
|
50
|
+
* - `useAnimation()`
|
|
51
|
+
* - `animateChild()`
|
|
39
52
|
*
|
|
40
|
-
*
|
|
53
|
+
* Programmatic animations built using the `AnimationBuilder` service also
|
|
54
|
+
* make use of `AnimationOptions`.
|
|
41
55
|
*/
|
|
42
56
|
export interface AnimationOptions {
|
|
57
|
+
/**
|
|
58
|
+
* Sets a time-delay for initiating an animation action.
|
|
59
|
+
* A number and optional time unit, such as "1s" or "10ms" for one second
|
|
60
|
+
* and 10 milliseconds, respectively.The default unit is milliseconds.
|
|
61
|
+
* Default value is 0, meaning no delay.
|
|
62
|
+
*/
|
|
43
63
|
delay?: number | string;
|
|
64
|
+
/**
|
|
65
|
+
* A set of developer-defined parameters that modify styling and timing
|
|
66
|
+
* when an animation action starts. An array of key-value pairs, where the provided value
|
|
67
|
+
* is used as a default.
|
|
68
|
+
*/
|
|
44
69
|
params?: {
|
|
45
70
|
[name: string]: any;
|
|
46
71
|
};
|
|
47
72
|
}
|
|
48
73
|
/**
|
|
49
|
-
*
|
|
50
|
-
* within the Angular animation DSL when {@link animateChild animateChild()} is used.
|
|
74
|
+
* Adds duration options to control animation styling and timing for a child animation.
|
|
51
75
|
*
|
|
52
|
-
* @
|
|
76
|
+
* @see `animateChild()`
|
|
53
77
|
*/
|
|
54
78
|
export interface AnimateChildOptions extends AnimationOptions {
|
|
55
79
|
duration?: number | string;
|
|
56
80
|
}
|
|
57
81
|
/**
|
|
58
|
-
*
|
|
59
|
-
* each time an animation DSL function is used.
|
|
82
|
+
* @description Constants for the categories of parameters that can be defined for animations.
|
|
60
83
|
*
|
|
61
|
-
*
|
|
84
|
+
* A corresponding function defines a set of parameters for each category, and
|
|
85
|
+
* collects them into a corresponding `AnimationMetadata` object.
|
|
62
86
|
*/
|
|
63
87
|
export declare const enum AnimationMetadataType {
|
|
88
|
+
/**
|
|
89
|
+
* Associates a named animation state with a set of CSS styles.
|
|
90
|
+
* See `state()`
|
|
91
|
+
*/
|
|
64
92
|
State = 0,
|
|
93
|
+
/**
|
|
94
|
+
* Data for a transition from one animation state to another.
|
|
95
|
+
* See `transition()`
|
|
96
|
+
*/
|
|
65
97
|
Transition = 1,
|
|
98
|
+
/**
|
|
99
|
+
* Contains a set of animation steps.
|
|
100
|
+
* See `sequence()`
|
|
101
|
+
*/
|
|
66
102
|
Sequence = 2,
|
|
103
|
+
/**
|
|
104
|
+
* Contains a set of animation steps.
|
|
105
|
+
* See `{@link animations/group group()}`
|
|
106
|
+
*/
|
|
67
107
|
Group = 3,
|
|
108
|
+
/**
|
|
109
|
+
* Contains an animation step.
|
|
110
|
+
* See `animate()`
|
|
111
|
+
*/
|
|
68
112
|
Animate = 4,
|
|
113
|
+
/**
|
|
114
|
+
* Contains a set of animation steps.
|
|
115
|
+
* See `keyframes()`
|
|
116
|
+
*/
|
|
69
117
|
Keyframes = 5,
|
|
118
|
+
/**
|
|
119
|
+
* Contains a set of CSS property-value pairs into a named style.
|
|
120
|
+
* See `style()`
|
|
121
|
+
*/
|
|
70
122
|
Style = 6,
|
|
123
|
+
/**
|
|
124
|
+
* Associates an animation with an entry trigger that can be attached to an element.
|
|
125
|
+
* See `trigger()`
|
|
126
|
+
*/
|
|
71
127
|
Trigger = 7,
|
|
128
|
+
/**
|
|
129
|
+
* Contains a re-usable animation.
|
|
130
|
+
* See `animation()`
|
|
131
|
+
*/
|
|
72
132
|
Reference = 8,
|
|
133
|
+
/**
|
|
134
|
+
* Contains data to use in executing child animations returned by a query.
|
|
135
|
+
* See `animateChild()`
|
|
136
|
+
*/
|
|
73
137
|
AnimateChild = 9,
|
|
138
|
+
/**
|
|
139
|
+
* Contains animation parameters for a re-usable animation.
|
|
140
|
+
* See `useAnimation()`
|
|
141
|
+
*/
|
|
74
142
|
AnimateRef = 10,
|
|
143
|
+
/**
|
|
144
|
+
* Contains child-animation query data.
|
|
145
|
+
* See `query()`
|
|
146
|
+
*/
|
|
75
147
|
Query = 11,
|
|
148
|
+
/**
|
|
149
|
+
* Contains data for staggering an animation sequence.
|
|
150
|
+
* See `stagger()`
|
|
151
|
+
*/
|
|
76
152
|
Stagger = 12,
|
|
77
153
|
}
|
|
78
154
|
/**
|
|
79
|
-
*
|
|
155
|
+
* Specifies automatic styling.
|
|
80
156
|
*/
|
|
81
157
|
export declare const AUTO_STYLE = "*";
|
|
82
158
|
/**
|
|
83
|
-
*
|
|
159
|
+
* Base for animation data structures.
|
|
84
160
|
*/
|
|
85
161
|
export interface AnimationMetadata {
|
|
86
162
|
type: AnimationMetadataType;
|
|
87
163
|
}
|
|
88
164
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* @experimental Animation support is experimental.
|
|
165
|
+
* Contains an animation trigger. Instantiated and returned by the
|
|
166
|
+
* `trigger()` function.
|
|
93
167
|
*/
|
|
94
168
|
export interface AnimationTriggerMetadata extends AnimationMetadata {
|
|
169
|
+
/**
|
|
170
|
+
* The trigger name, used to associate it with an element. Unique within the component.
|
|
171
|
+
*/
|
|
95
172
|
name: string;
|
|
173
|
+
/**
|
|
174
|
+
* An animation definition object, containing an array of state and transition declarations.
|
|
175
|
+
*/
|
|
96
176
|
definitions: AnimationMetadata[];
|
|
177
|
+
/**
|
|
178
|
+
* An options object containing a delay and
|
|
179
|
+
* developer-defined parameters that provide styling defaults and
|
|
180
|
+
* can be overridden on invocation. Default delay is 0.
|
|
181
|
+
*/
|
|
97
182
|
options: {
|
|
98
183
|
params?: {
|
|
99
184
|
[name: string]: any;
|
|
@@ -101,14 +186,23 @@ export interface AnimationTriggerMetadata extends AnimationMetadata {
|
|
|
101
186
|
} | null;
|
|
102
187
|
}
|
|
103
188
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* @experimental Animation support is experimental.
|
|
189
|
+
* Encapsulates an animation state by associating a state name with a set of CSS styles.
|
|
190
|
+
* Instantiated and returned by the `state()` function.
|
|
108
191
|
*/
|
|
109
192
|
export interface AnimationStateMetadata extends AnimationMetadata {
|
|
193
|
+
/**
|
|
194
|
+
* The state name, unique within the component.
|
|
195
|
+
*/
|
|
110
196
|
name: string;
|
|
197
|
+
/**
|
|
198
|
+
* The CSS styles associated with this state.
|
|
199
|
+
*/
|
|
111
200
|
styles: AnimationStyleMetadata;
|
|
201
|
+
/**
|
|
202
|
+
* An options object containing
|
|
203
|
+
* developer-defined parameters that provide styling defaults and
|
|
204
|
+
* can be overridden on invocation.
|
|
205
|
+
*/
|
|
112
206
|
options?: {
|
|
113
207
|
params: {
|
|
114
208
|
[name: string]: any;
|
|
@@ -116,163 +210,230 @@ export interface AnimationStateMetadata extends AnimationMetadata {
|
|
|
116
210
|
};
|
|
117
211
|
}
|
|
118
212
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* @experimental Animation support is experimental.
|
|
213
|
+
* Encapsulates an animation transition. Instantiated and returned by the
|
|
214
|
+
* `transition()` function.
|
|
123
215
|
*/
|
|
124
216
|
export interface AnimationTransitionMetadata extends AnimationMetadata {
|
|
217
|
+
/**
|
|
218
|
+
* An expression that describes a state change.
|
|
219
|
+
*/
|
|
125
220
|
expr: string | ((fromState: string, toState: string, element?: any, params?: {
|
|
126
221
|
[key: string]: any;
|
|
127
222
|
}) => boolean);
|
|
223
|
+
/**
|
|
224
|
+
* One or more animation objects to which this transition applies.
|
|
225
|
+
*/
|
|
128
226
|
animation: AnimationMetadata | AnimationMetadata[];
|
|
227
|
+
/**
|
|
228
|
+
* An options object containing a delay and
|
|
229
|
+
* developer-defined parameters that provide styling defaults and
|
|
230
|
+
* can be overridden on invocation. Default delay is 0.
|
|
231
|
+
*/
|
|
129
232
|
options: AnimationOptions | null;
|
|
130
233
|
}
|
|
131
234
|
/**
|
|
132
|
-
*
|
|
235
|
+
* Encapsulates a reusable animation, which is a collection of individual animation steps.
|
|
236
|
+
* Instantiated and returned by the `animation()` function, and
|
|
237
|
+
* passed to the `useAnimation()` function.
|
|
133
238
|
*/
|
|
134
239
|
export interface AnimationReferenceMetadata extends AnimationMetadata {
|
|
240
|
+
/**
|
|
241
|
+
* One or more animation step objects.
|
|
242
|
+
*/
|
|
135
243
|
animation: AnimationMetadata | AnimationMetadata[];
|
|
244
|
+
/**
|
|
245
|
+
* An options object containing a delay and
|
|
246
|
+
* developer-defined parameters that provide styling defaults and
|
|
247
|
+
* can be overridden on invocation. Default delay is 0.
|
|
248
|
+
*/
|
|
136
249
|
options: AnimationOptions | null;
|
|
137
250
|
}
|
|
138
251
|
/**
|
|
139
|
-
*
|
|
252
|
+
* Encapsulates an animation query. Instantiated and returned by
|
|
253
|
+
* the `query()` function.
|
|
140
254
|
*/
|
|
141
255
|
export interface AnimationQueryMetadata extends AnimationMetadata {
|
|
256
|
+
/**
|
|
257
|
+
* The CSS selector for this query.
|
|
258
|
+
*/
|
|
142
259
|
selector: string;
|
|
260
|
+
/**
|
|
261
|
+
* One or more animation step objects.
|
|
262
|
+
*/
|
|
143
263
|
animation: AnimationMetadata | AnimationMetadata[];
|
|
264
|
+
/**
|
|
265
|
+
* A query options object.
|
|
266
|
+
*/
|
|
144
267
|
options: AnimationQueryOptions | null;
|
|
145
268
|
}
|
|
146
269
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* @experimental Animation support is experimental.
|
|
270
|
+
* Encapsulates a keyframes sequence. Instantiated and returned by
|
|
271
|
+
* the `keyframes()` function.
|
|
151
272
|
*/
|
|
152
273
|
export interface AnimationKeyframesSequenceMetadata extends AnimationMetadata {
|
|
274
|
+
/**
|
|
275
|
+
* An array of animation styles.
|
|
276
|
+
*/
|
|
153
277
|
steps: AnimationStyleMetadata[];
|
|
154
278
|
}
|
|
155
279
|
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* @experimental Animation support is experimental.
|
|
280
|
+
* Encapsulates an animation style. Instantiated and returned by
|
|
281
|
+
* the `style()` function.
|
|
160
282
|
*/
|
|
161
283
|
export interface AnimationStyleMetadata extends AnimationMetadata {
|
|
284
|
+
/**
|
|
285
|
+
* A set of CSS style properties.
|
|
286
|
+
*/
|
|
162
287
|
styles: '*' | {
|
|
163
288
|
[key: string]: string | number;
|
|
164
289
|
} | Array<{
|
|
165
290
|
[key: string]: string | number;
|
|
166
291
|
} | '*'>;
|
|
292
|
+
/**
|
|
293
|
+
* A percentage of the total animate time at which the style is to be applied.
|
|
294
|
+
*/
|
|
167
295
|
offset: number | null;
|
|
168
296
|
}
|
|
169
297
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* @experimental Animation support is experimental.
|
|
298
|
+
* Encapsulates an animation step. Instantiated and returned by
|
|
299
|
+
* the `animate()` function.
|
|
174
300
|
*/
|
|
175
301
|
export interface AnimationAnimateMetadata extends AnimationMetadata {
|
|
302
|
+
/**
|
|
303
|
+
* The timing data for the step.
|
|
304
|
+
*/
|
|
176
305
|
timings: string | number | AnimateTimings;
|
|
306
|
+
/**
|
|
307
|
+
* A set of styles used in the step.
|
|
308
|
+
*/
|
|
177
309
|
styles: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata | null;
|
|
178
310
|
}
|
|
179
311
|
/**
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
* @experimental Animation support is experimental.
|
|
312
|
+
* Encapsulates a child animation, that can be run explicitly when the parent is run.
|
|
313
|
+
* Instantiated and returned by the `animateChild` function.
|
|
184
314
|
*/
|
|
185
315
|
export interface AnimationAnimateChildMetadata extends AnimationMetadata {
|
|
316
|
+
/**
|
|
317
|
+
* An options object containing a delay and
|
|
318
|
+
* developer-defined parameters that provide styling defaults and
|
|
319
|
+
* can be overridden on invocation. Default delay is 0.
|
|
320
|
+
*/
|
|
186
321
|
options: AnimationOptions | null;
|
|
187
322
|
}
|
|
188
323
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* @experimental Animation support is experimental.
|
|
324
|
+
* Encapsulates a reusable animation.
|
|
325
|
+
* Instantiated and returned by the `useAnimation()` function.
|
|
193
326
|
*/
|
|
194
327
|
export interface AnimationAnimateRefMetadata extends AnimationMetadata {
|
|
328
|
+
/**
|
|
329
|
+
* An animation reference object.
|
|
330
|
+
*/
|
|
195
331
|
animation: AnimationReferenceMetadata;
|
|
332
|
+
/**
|
|
333
|
+
* An options object containing a delay and
|
|
334
|
+
* developer-defined parameters that provide styling defaults and
|
|
335
|
+
* can be overridden on invocation. Default delay is 0.
|
|
336
|
+
*/
|
|
196
337
|
options: AnimationOptions | null;
|
|
197
338
|
}
|
|
198
339
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* @experimental Animation support is experimental.
|
|
340
|
+
* Encapsulates an animation sequence.
|
|
341
|
+
* Instantiated and returned by the `sequence()` function.
|
|
203
342
|
*/
|
|
204
343
|
export interface AnimationSequenceMetadata extends AnimationMetadata {
|
|
344
|
+
/**
|
|
345
|
+
* An array of animation step objects.
|
|
346
|
+
*/
|
|
205
347
|
steps: AnimationMetadata[];
|
|
348
|
+
/**
|
|
349
|
+
* An options object containing a delay and
|
|
350
|
+
* developer-defined parameters that provide styling defaults and
|
|
351
|
+
* can be overridden on invocation. Default delay is 0.
|
|
352
|
+
*/
|
|
206
353
|
options: AnimationOptions | null;
|
|
207
354
|
}
|
|
208
355
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* @experimental Animation support is experimental.
|
|
356
|
+
* Encapsulates an animation group.
|
|
357
|
+
* Instantiated and returned by the `{@link animations/group group()}` function.
|
|
213
358
|
*/
|
|
214
359
|
export interface AnimationGroupMetadata extends AnimationMetadata {
|
|
360
|
+
/**
|
|
361
|
+
* One or more animation or style steps that form this group.
|
|
362
|
+
*/
|
|
215
363
|
steps: AnimationMetadata[];
|
|
364
|
+
/**
|
|
365
|
+
* An options object containing a delay and
|
|
366
|
+
* developer-defined parameters that provide styling defaults and
|
|
367
|
+
* can be overridden on invocation. Default delay is 0.
|
|
368
|
+
*/
|
|
216
369
|
options: AnimationOptions | null;
|
|
217
370
|
}
|
|
218
371
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* @experimental Animation support is experimental.
|
|
372
|
+
* Encapsulates animation query options.
|
|
373
|
+
* Passed to the `query()` function.
|
|
223
374
|
*/
|
|
224
375
|
export interface AnimationQueryOptions extends AnimationOptions {
|
|
225
|
-
optional?: boolean;
|
|
226
376
|
/**
|
|
227
|
-
*
|
|
377
|
+
* True if this query is optional, false if it is required. Default is false.
|
|
378
|
+
* A required query throws an error if no elements are retrieved when
|
|
379
|
+
* the query is executed. An optional query does not.
|
|
228
380
|
*
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
381
|
+
*/
|
|
382
|
+
optional?: boolean;
|
|
383
|
+
/**
|
|
384
|
+
* A maximum total number of results to return from the query.
|
|
385
|
+
* If negative, results are limited from the end of the query list towards the beginning.
|
|
386
|
+
* By default, results are not limited.
|
|
232
387
|
*/
|
|
233
388
|
limit?: number;
|
|
234
389
|
}
|
|
235
390
|
/**
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
|
|
239
|
-
* @experimental Animation support is experimental.
|
|
240
|
-
*/
|
|
391
|
+
* Encapsulates parameters for staggering the start times of a set of animation steps.
|
|
392
|
+
* Instantiated and returned by the `stagger()` function.
|
|
393
|
+
**/
|
|
241
394
|
export interface AnimationStaggerMetadata extends AnimationMetadata {
|
|
395
|
+
/**
|
|
396
|
+
* The timing data for the steps.
|
|
397
|
+
*/
|
|
242
398
|
timings: string | number;
|
|
399
|
+
/**
|
|
400
|
+
* One or more animation steps.
|
|
401
|
+
*/
|
|
243
402
|
animation: AnimationMetadata | AnimationMetadata[];
|
|
244
403
|
}
|
|
245
404
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* {@link Component#animations component animations metadata page} to gain a better
|
|
249
|
-
* understanding of how animations in Angular are used.
|
|
250
|
-
*
|
|
251
|
-
* `trigger` Creates an animation trigger which will a list of {@link state state} and
|
|
252
|
-
* {@link transition transition} entries that will be evaluated when the expression
|
|
405
|
+
* Creates a named animation trigger, containing a list of `state()`
|
|
406
|
+
* and `transition()` entries to be evaluated when the expression
|
|
253
407
|
* bound to the trigger changes.
|
|
254
408
|
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
the
|
|
259
|
-
* trigger is bound to (in the form of `[@triggerName]="expression"`.
|
|
409
|
+
* @param name An identifying string.
|
|
410
|
+
* @param definitions An animation definition object, containing an array of `state()`
|
|
411
|
+
* and `transition()` declarations.
|
|
260
412
|
*
|
|
261
|
-
*
|
|
262
|
-
* any linked transitions. If a boolean value is provided into the trigger binding then it will both
|
|
263
|
-
* be represented as `1` or `true` and `0` or `false` for a true and false boolean values
|
|
264
|
-
* respectively.
|
|
413
|
+
* @return An object that encapsulates the trigger data.
|
|
265
414
|
*
|
|
266
|
-
*
|
|
415
|
+
* @usageNotes
|
|
416
|
+
* Define an animation trigger in the `animations` section of `@Component` metadata.
|
|
417
|
+
* In the template, reference the trigger by name and bind it to a trigger expression that
|
|
418
|
+
* evaluates to a defined animation state, using the following format:
|
|
419
|
+
*
|
|
420
|
+
* `[@triggerName]="expression"`
|
|
267
421
|
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
422
|
+
* Animation trigger bindings convert all values to strings, and then match the
|
|
423
|
+
* previous and current values against any linked transitions.
|
|
424
|
+
* Booleans can be specified as `1` or `true` and `0` or `false`.
|
|
425
|
+
*
|
|
426
|
+
* ### Usage Example
|
|
427
|
+
*
|
|
428
|
+
* The following example creates an animation trigger reference based on the provided
|
|
429
|
+
* name value.
|
|
430
|
+
* The provided animation value is expected to be an array consisting of state and
|
|
431
|
+
* transition declarations.
|
|
271
432
|
*
|
|
272
433
|
* ```typescript
|
|
273
434
|
* @Component({
|
|
274
|
-
* selector:
|
|
275
|
-
* templateUrl:
|
|
435
|
+
* selector: "my-component",
|
|
436
|
+
* templateUrl: "my-component-tpl.html",
|
|
276
437
|
* animations: [
|
|
277
438
|
* trigger("myAnimationTrigger", [
|
|
278
439
|
* state(...),
|
|
@@ -287,8 +448,8 @@ export interface AnimationStaggerMetadata extends AnimationMetadata {
|
|
|
287
448
|
* }
|
|
288
449
|
* ```
|
|
289
450
|
*
|
|
290
|
-
* The template associated with this component
|
|
291
|
-
|
|
451
|
+
* The template associated with this component makes use of the defined trigger
|
|
452
|
+
* by binding to an element within its template code.
|
|
292
453
|
*
|
|
293
454
|
* ```html
|
|
294
455
|
* <!-- somewhere inside of my-component-tpl.html -->
|
|
@@ -299,9 +460,8 @@ export interface AnimationStaggerMetadata extends AnimationMetadata {
|
|
|
299
460
|
* The `transition` animation method also supports reading an inline function which can decide
|
|
300
461
|
* if its associated animation should be run.
|
|
301
462
|
*
|
|
302
|
-
* ```
|
|
303
|
-
* // this method
|
|
304
|
-
* // trigger value changes...
|
|
463
|
+
* ```typescript
|
|
464
|
+
* // this method is run each time the `myAnimationTrigger` trigger value changes.
|
|
305
465
|
* function myInlineMatcherFn(fromState: string, toState: string, element: any, params: {[key:
|
|
306
466
|
string]: any}): boolean {
|
|
307
467
|
* // notice that `element` and `params` are also available here
|
|
@@ -324,18 +484,16 @@ export interface AnimationStaggerMetadata extends AnimationMetadata {
|
|
|
324
484
|
* }
|
|
325
485
|
* ```
|
|
326
486
|
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
487
|
+
* ### Disabling Animations
|
|
488
|
+
* When true, the special animation control binding `@.disabled` binding prevents
|
|
489
|
+
* all animations from rendering.
|
|
490
|
+
* Place the `@.disabled` binding on an element to disable
|
|
491
|
+
* animations on the element itself, as well as any inner animation triggers
|
|
492
|
+
* within the element.
|
|
329
493
|
*
|
|
330
|
-
*
|
|
331
|
-
* A special animation control binding called `@.disabled` can be placed on an element which will
|
|
332
|
-
then disable animations for any inner animation triggers situated within the element as well as
|
|
333
|
-
any animations on the element itself.
|
|
494
|
+
* The following example shows how to use this feature:
|
|
334
495
|
*
|
|
335
|
-
*
|
|
336
|
-
below shows how to use this feature:
|
|
337
|
-
*
|
|
338
|
-
* ```ts
|
|
496
|
+
* ```typescript
|
|
339
497
|
* @Component({
|
|
340
498
|
* selector: 'my-component',
|
|
341
499
|
* template: `
|
|
@@ -355,19 +513,16 @@ export interface AnimationStaggerMetadata extends AnimationMetadata {
|
|
|
355
513
|
* }
|
|
356
514
|
* ```
|
|
357
515
|
*
|
|
358
|
-
*
|
|
359
|
-
|
|
516
|
+
* When `@.disabled` is true, it prevents the `@childAnimation` trigger from animating,
|
|
517
|
+
* along with any inner animations.
|
|
360
518
|
*
|
|
361
|
-
*
|
|
362
|
-
* the
|
|
519
|
+
* ### Disable animations application-wide
|
|
520
|
+
* When an area of the template is set to have animations disabled,
|
|
521
|
+
* **all** inner components have their animations disabled as well.
|
|
522
|
+
* This means that you can disable all animations for an app
|
|
523
|
+
* by placing a host binding set on `@.disabled` on the topmost Angular component.
|
|
363
524
|
*
|
|
364
|
-
*
|
|
365
|
-
* When an area of the template is set to have animations disabled, **all** inner components will
|
|
366
|
-
also have their animations disabled as well. This means that all animations for an angular
|
|
367
|
-
application can be disabled by placing a host binding set on `@.disabled` on the topmost Angular
|
|
368
|
-
component.
|
|
369
|
-
*
|
|
370
|
-
* ```ts
|
|
525
|
+
* ```typescript
|
|
371
526
|
* import {Component, HostBinding} from '@angular/core';
|
|
372
527
|
*
|
|
373
528
|
* @Component({
|
|
@@ -380,88 +535,87 @@ export interface AnimationStaggerMetadata extends AnimationMetadata {
|
|
|
380
535
|
* }
|
|
381
536
|
* ```
|
|
382
537
|
*
|
|
383
|
-
* ###
|
|
384
|
-
* Despite inner animations being disabled, a parent animation can
|
|
385
|
-
elements located in disabled areas of the template and still animate
|
|
386
|
-
also the case for when a sub animation is
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
* ### Detecting when an animation is disabled
|
|
390
|
-
* If a region of the DOM (or the entire application) has its animations disabled, then animation
|
|
391
|
-
* trigger callbacks will still fire just as normal (only for zero seconds).
|
|
538
|
+
* ### Overriding disablement of inner animations
|
|
539
|
+
* Despite inner animations being disabled, a parent animation can `query()`
|
|
540
|
+
* for inner elements located in disabled areas of the template and still animate
|
|
541
|
+
* them if needed. This is also the case for when a sub animation is
|
|
542
|
+
* queried by a parent and then later animated using `animateChild()`.
|
|
392
543
|
*
|
|
393
|
-
*
|
|
394
|
-
animations
|
|
395
|
-
*
|
|
544
|
+
* ### Detecting when an animation is disabled
|
|
545
|
+
* If a region of the DOM (or the entire application) has its animations disabled, the animation
|
|
546
|
+
* trigger callbacks still fire, but for zero seconds. When the callback fires, it provides
|
|
547
|
+
* an instance of an `AnimationEvent`. If animations are disabled,
|
|
548
|
+
* the `.disabled` flag on the event is true.
|
|
396
549
|
*
|
|
397
550
|
* @experimental Animation support is experimental.
|
|
398
551
|
*/
|
|
399
552
|
export declare function trigger(name: string, definitions: AnimationMetadata[]): AnimationTriggerMetadata;
|
|
400
553
|
/**
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
554
|
+
* Defines an animation step that combines styling information with timing information.
|
|
555
|
+
*
|
|
556
|
+
* @param timings Sets `AnimateTimings` for the parent animation.
|
|
557
|
+
* A string in the format "duration [delay] [easing]".
|
|
558
|
+
* - Duration and delay are expressed as a number and optional time unit,
|
|
559
|
+
* such as "1s" or "10ms" for one second and 10 milliseconds, respectively.
|
|
560
|
+
* The default unit is milliseconds.
|
|
561
|
+
* - The easing value controls how the animation accelerates and decelerates
|
|
562
|
+
* during its runtime. Value is one of `ease`, `ease-in`, `ease-out`,
|
|
563
|
+
* `ease-in-out`, or a `cubic-bezier()` function call.
|
|
564
|
+
* If not supplied, no easing is applied.
|
|
565
|
+
*
|
|
566
|
+
* For example, the string "1s 100ms ease-out" specifies a duration of
|
|
567
|
+
* 1000 milliseconds, and delay of 100 ms, and the "ease-out" easing style,
|
|
568
|
+
* which decelerates near the end of the duration.
|
|
569
|
+
* @param styles Sets AnimationStyles for the parent animation.
|
|
570
|
+
* A function call to either `style()` or `keyframes()`
|
|
571
|
+
* that returns a collection of CSS style entries to be applied to the parent animation.
|
|
572
|
+
* When null, uses the styles from the destination state.
|
|
573
|
+
* This is useful when describing an animation step that will complete an animation;
|
|
574
|
+
* see "Animating to the final state" in `transitions()`.
|
|
575
|
+
* @returns An object that encapsulates the animation step.
|
|
576
|
+
*
|
|
577
|
+
* @usageNotes
|
|
578
|
+
* Call within an animation `sequence()`, `{@link animations/group group()}`, or
|
|
579
|
+
* `transition()` call to specify an animation step
|
|
580
|
+
* that applies given style data to the parent animation for a given amount of time.
|
|
581
|
+
*
|
|
582
|
+
* ### Syntax Examples
|
|
583
|
+
* **Timing examples**
|
|
584
|
+
*
|
|
585
|
+
* The following examples show various `timings` specifications.
|
|
586
|
+
* - `animate(500)` : Duration is 500 milliseconds.
|
|
587
|
+
* - `animate("1s")` : Duration is 1000 milliseconds.
|
|
588
|
+
* - `animate("100ms 0.5s")` : Duration is 100 milliseconds, delay is 500 milliseconds.
|
|
589
|
+
* - `animate("5s ease-in")` : Duration is 5000 milliseconds, easing in.
|
|
590
|
+
* - `animate("5s 10ms cubic-bezier(.17,.67,.88,.1)")` : Duration is 5000 milliseconds, delay is 10
|
|
591
|
+
* milliseconds, easing according to a bezier curve.
|
|
592
|
+
*
|
|
593
|
+
* **Style examples**
|
|
594
|
+
*
|
|
595
|
+
* The following example calls `style()` to set a single CSS style.
|
|
425
596
|
* ```typescript
|
|
426
|
-
* // various functions for specifying timing data
|
|
427
|
-
* animate(500, style(...))
|
|
428
|
-
* animate("1s", style(...))
|
|
429
|
-
* animate("100ms 0.5s", style(...))
|
|
430
|
-
* animate("5s ease", style(...))
|
|
431
|
-
* animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...))
|
|
432
|
-
*
|
|
433
|
-
* // either style() of keyframes() can be used
|
|
434
597
|
* animate(500, style({ background: "red" }))
|
|
435
|
-
*
|
|
598
|
+
* ```
|
|
599
|
+
* The following example calls `keyframes()` to set a CSS style
|
|
600
|
+
* to different values for successive keyframes.
|
|
601
|
+
* ```typescript
|
|
602
|
+
* animate(500, keyframes(
|
|
603
|
+
* [
|
|
436
604
|
* style({ background: "blue" })),
|
|
437
605
|
* style({ background: "red" }))
|
|
438
|
-
*
|
|
606
|
+
* ])
|
|
439
607
|
* ```
|
|
440
|
-
*
|
|
441
|
-
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
|
442
|
-
*
|
|
443
|
-
* @experimental Animation support is experimental.
|
|
444
608
|
*/
|
|
445
609
|
export declare function animate(timings: string | number, styles?: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata | null): AnimationAnimateMetadata;
|
|
446
610
|
/**
|
|
447
|
-
*
|
|
448
|
-
* animation DSL language. If this information is new, please navigate to the {@link
|
|
449
|
-
* Component#animations component animations metadata page} to gain a better understanding of
|
|
450
|
-
* how animations in Angular are used.
|
|
611
|
+
* @description Defines a list of animation steps to be run in parallel.
|
|
451
612
|
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
* ### Usage
|
|
460
|
-
*
|
|
461
|
-
* The `steps` data that is passed into the `group` animation function can either consist of {@link
|
|
462
|
-
* style style} or {@link animate animate} function calls. Each call to `style()` or `animate()`
|
|
463
|
-
* within a group will be executed instantly (use {@link keyframes keyframes} or a {@link
|
|
464
|
-
* animate#usage animate() with a delay value} to offset styles to be applied at a later time).
|
|
613
|
+
* @param steps An array of animation step objects.
|
|
614
|
+
* - When steps are defined by `style()` or `animate()`
|
|
615
|
+
* function calls, each call within the group is executed instantly.
|
|
616
|
+
* - To specify offset styles to be applied at a later time, define steps with
|
|
617
|
+
* `keyframes()`, or use `animate()` calls with a delay value.
|
|
618
|
+
* For example:
|
|
465
619
|
*
|
|
466
620
|
* ```typescript
|
|
467
621
|
* group([
|
|
@@ -470,33 +624,28 @@ export declare function animate(timings: string | number, styles?: AnimationStyl
|
|
|
470
624
|
* ])
|
|
471
625
|
* ```
|
|
472
626
|
*
|
|
473
|
-
*
|
|
627
|
+
* @param options An options object containing a delay and
|
|
628
|
+
* developer-defined parameters that provide styling defaults and
|
|
629
|
+
* can be overridden on invocation.
|
|
474
630
|
*
|
|
475
|
-
* @
|
|
631
|
+
* @return An object that encapsulates the group data.
|
|
632
|
+
*
|
|
633
|
+
* @usageNotes
|
|
634
|
+
* Grouped animations are useful when a series of styles must be
|
|
635
|
+
* animated at different starting times and closed off at different ending times.
|
|
636
|
+
*
|
|
637
|
+
* When called within a `sequence()` or a
|
|
638
|
+
* `transition()` call, does not continue to the next
|
|
639
|
+
* instruction until all of the inner animation steps have completed.
|
|
476
640
|
*/
|
|
477
641
|
export declare function group(steps: AnimationMetadata[], options?: AnimationOptions | null): AnimationGroupMetadata;
|
|
478
642
|
/**
|
|
479
|
-
*
|
|
480
|
-
* animation DSL language. If this information is new, please navigate to the {@link
|
|
481
|
-
* Component#animations component animations metadata page} to gain a better understanding of
|
|
482
|
-
* how animations in Angular are used.
|
|
483
|
-
*
|
|
484
|
-
* `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by
|
|
485
|
-
* default when an array is passed as animation data into {@link transition transition}.)
|
|
643
|
+
* Defines a list of animation steps to be run sequentially, one by one.
|
|
486
644
|
*
|
|
487
|
-
*
|
|
488
|
-
*
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
* To perform animation styling in parallel with other animation steps then have a look at the
|
|
492
|
-
* {@link group group} animation function.
|
|
493
|
-
*
|
|
494
|
-
* ### Usage
|
|
495
|
-
*
|
|
496
|
-
* The `steps` data that is passed into the `sequence` animation function can either consist of
|
|
497
|
-
* {@link style style} or {@link animate animate} function calls. A call to `style()` will apply the
|
|
498
|
-
* provided styling data immediately while a call to `animate()` will apply its styling data over a
|
|
499
|
-
* given time depending on its timing data.
|
|
645
|
+
* @param steps An array of animation step objects.
|
|
646
|
+
* - Steps defined by `style()` calls apply the styling data immediately.
|
|
647
|
+
* - Steps defined by `animate()` calls apply the styling data over time
|
|
648
|
+
* as specified by the timing data.
|
|
500
649
|
*
|
|
501
650
|
* ```typescript
|
|
502
651
|
* sequence([
|
|
@@ -505,132 +654,121 @@ export declare function group(steps: AnimationMetadata[], options?: AnimationOpt
|
|
|
505
654
|
* ])
|
|
506
655
|
* ```
|
|
507
656
|
*
|
|
508
|
-
*
|
|
657
|
+
* @param options An options object containing a delay and
|
|
658
|
+
* developer-defined parameters that provide styling defaults and
|
|
659
|
+
* can be overridden on invocation.
|
|
509
660
|
*
|
|
510
|
-
* @
|
|
511
|
-
|
|
661
|
+
* @return An object that encapsulates the sequence data.
|
|
662
|
+
*
|
|
663
|
+
* @usageNotes
|
|
664
|
+
* When you pass an array of steps to a
|
|
665
|
+
* `transition()` call, the steps run sequentially by default.
|
|
666
|
+
* Compare this to the `{@link animations/group group()}` call, which runs animation steps in parallel.
|
|
667
|
+
*
|
|
668
|
+
* When a sequence is used within a `{@link animations/group group()}` or a `transition()` call,
|
|
669
|
+
* execution continues to the next instruction only after each of the inner animation
|
|
670
|
+
* steps have completed.
|
|
671
|
+
*
|
|
672
|
+
**/
|
|
512
673
|
export declare function sequence(steps: AnimationMetadata[], options?: AnimationOptions | null): AnimationSequenceMetadata;
|
|
513
674
|
/**
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
* how animations in Angular are used.
|
|
675
|
+
* Declares a key/value object containing CSS properties/styles that
|
|
676
|
+
* can then be used for an animation `state`, within an animation `sequence`,
|
|
677
|
+
* or as styling data for calls to `animate()` and `keyframes()`.
|
|
518
678
|
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
*
|
|
679
|
+
* @param tokens A set of CSS styles or HTML styles associated with an animation state.
|
|
680
|
+
* The value can be any of the following:
|
|
681
|
+
* - A key-value style pair associating a CSS property with a value.
|
|
682
|
+
* - An array of key-value style pairs.
|
|
683
|
+
* - An asterisk (*), to use auto-styling, where styles are derived from the element
|
|
684
|
+
* being animated and applied to the animation when it starts.
|
|
522
685
|
*
|
|
523
|
-
*
|
|
686
|
+
* Auto-styling can be used to define a state that depends on layout or other
|
|
687
|
+
* environmental factors.
|
|
688
|
+
*
|
|
689
|
+
* @return An object that encapsulates the style data.
|
|
524
690
|
*
|
|
525
|
-
*
|
|
526
|
-
*
|
|
691
|
+
* @usageNotes
|
|
692
|
+
* The following examples create animation styles that collect a set of
|
|
693
|
+
* CSS property values:
|
|
527
694
|
*
|
|
528
695
|
* ```typescript
|
|
529
|
-
* // string values
|
|
696
|
+
* // string values for CSS properties
|
|
530
697
|
* style({ background: "red", color: "blue" })
|
|
531
698
|
*
|
|
532
|
-
* // numerical
|
|
699
|
+
* // numerical pixel values
|
|
533
700
|
* style({ width: 100, height: 0 })
|
|
534
701
|
* ```
|
|
535
702
|
*
|
|
536
|
-
*
|
|
537
|
-
*
|
|
538
|
-
* When an asterix (`*`) character is used as a value then it will be detected from the element
|
|
539
|
-
* being animated and applied as animation data when the animation starts.
|
|
703
|
+
* The following example uses auto-styling to allow a component to animate from
|
|
704
|
+
* a height of 0 up to the height of the parent element:
|
|
540
705
|
*
|
|
541
|
-
*
|
|
542
|
-
* cases the styles are calculated just before the animation starts.
|
|
543
|
-
*
|
|
544
|
-
* ```typescript
|
|
545
|
-
* // the steps below will animate from 0 to the
|
|
546
|
-
* // actual height of the element
|
|
706
|
+
* ```
|
|
547
707
|
* style({ height: 0 }),
|
|
548
708
|
* animate("1s", style({ height: "*" }))
|
|
549
709
|
* ```
|
|
550
710
|
*
|
|
551
|
-
|
|
552
|
-
*
|
|
553
|
-
* @experimental Animation support is experimental.
|
|
554
|
-
*/
|
|
711
|
+
**/
|
|
555
712
|
export declare function style(tokens: '*' | {
|
|
556
713
|
[key: string]: string | number;
|
|
557
714
|
} | Array<'*' | {
|
|
558
715
|
[key: string]: string | number;
|
|
559
716
|
}>): AnimationStyleMetadata;
|
|
560
717
|
/**
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
* trigger
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
*
|
|
583
|
-
*
|
|
584
|
-
*
|
|
585
|
-
*
|
|
586
|
-
|
|
587
|
-
* `state` will declare an animation state with its associated styles
|
|
588
|
-
* within the given trigger.
|
|
589
|
-
*
|
|
590
|
-
* - `stateNameExpr` can be one or more state names separated by commas.
|
|
591
|
-
* - `styles` refers to the {@link style styling data} that will be persisted on the element once
|
|
592
|
-
* the state has been reached.
|
|
593
|
-
*
|
|
594
|
-
* ```typescript
|
|
595
|
-
* // "void" is a reserved name for a state and is used to represent
|
|
596
|
-
* // the state in which an element is detached from from the application.
|
|
597
|
-
* state("void", style({ height: 0 }))
|
|
598
|
-
*
|
|
599
|
-
* // user-defined states
|
|
600
|
-
* state("closed", style({ height: 0 }))
|
|
601
|
-
* state("open, visible", style({ height: "*" }))
|
|
602
|
-
* ```
|
|
603
|
-
*
|
|
604
|
-
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
|
605
|
-
*
|
|
606
|
-
* @experimental Animation support is experimental.
|
|
607
|
-
*/
|
|
718
|
+
* Declares an animation state within a trigger attached to an element.
|
|
719
|
+
*
|
|
720
|
+
* @param name One or more names for the defined state in a comma-separated string.
|
|
721
|
+
* The following reserved state names can be supplied to define a style for specific use
|
|
722
|
+
* cases:
|
|
723
|
+
*
|
|
724
|
+
* - `void` You can associate styles with this name to be used when
|
|
725
|
+
* the element is detached from the application. For example, when an `ngIf` evaluates
|
|
726
|
+
* to false, the state of the associated element is void.
|
|
727
|
+
* - `*` (asterisk) Indicates the default state. You can associate styles with this name
|
|
728
|
+
* to be used as the fallback when the state that is being animated is not declared
|
|
729
|
+
* within the trigger.
|
|
730
|
+
*
|
|
731
|
+
* @param styles A set of CSS styles associated with this state, created using the
|
|
732
|
+
* `style()` function.
|
|
733
|
+
* This set of styles persists on the element once the state has been reached.
|
|
734
|
+
* @param options Parameters that can be passed to the state when it is invoked.
|
|
735
|
+
* 0 or more key-value pairs.
|
|
736
|
+
* @return An object that encapsulates the new state data.
|
|
737
|
+
*
|
|
738
|
+
* @usageNotes
|
|
739
|
+
* Use the `trigger()` function to register states to an animation trigger.
|
|
740
|
+
* Use the `transition()` function to animate between states.
|
|
741
|
+
* When a state is active within a component, its associated styles persist on the element,
|
|
742
|
+
* even when the animation ends.
|
|
743
|
+
**/
|
|
608
744
|
export declare function state(name: string, styles: AnimationStyleMetadata, options?: {
|
|
609
745
|
params: {
|
|
610
746
|
[name: string]: any;
|
|
611
747
|
};
|
|
612
748
|
}): AnimationStateMetadata;
|
|
613
749
|
/**
|
|
614
|
-
*
|
|
615
|
-
* animation DSL language. If this information is new, please navigate to the {@link
|
|
616
|
-
* Component#animations component animations metadata page} to gain a better understanding of
|
|
617
|
-
* how animations in Angular are used.
|
|
750
|
+
* Defines a set of animation styles, associating each style with an optional `offset` value.
|
|
618
751
|
*
|
|
619
|
-
*
|
|
620
|
-
*
|
|
752
|
+
* @param steps A set of animation styles with optional offset data.
|
|
753
|
+
* The optional `offset` value for a style specifies a percentage of the total animation
|
|
754
|
+
* time at which that style is applied.
|
|
755
|
+
* @returns An object that encapsulates the keyframes data.
|
|
621
756
|
*
|
|
622
|
-
*
|
|
757
|
+
* @usageNotes
|
|
758
|
+
* Use with the `animate()` call. Instead of applying animations
|
|
759
|
+
* from the current state
|
|
760
|
+
* to the destination state, keyframes describe how each style entry is applied and at what point
|
|
761
|
+
* within the animation arc.
|
|
762
|
+
* Compare [CSS Keyframe Animations](https://www.w3schools.com/css/css3_animations.asp).
|
|
623
763
|
*
|
|
624
|
-
*
|
|
625
|
-
* animation function. Instead of applying animations from where they are currently to their
|
|
626
|
-
* destination, keyframes can describe how each style entry is applied and at what point within the
|
|
627
|
-
* animation arc (much like CSS Keyframe Animations do).
|
|
764
|
+
* ### Usage
|
|
628
765
|
*
|
|
629
|
-
*
|
|
630
|
-
*
|
|
766
|
+
* In the following example, the offset values describe
|
|
767
|
+
* when each `backgroundColor` value is applied. The color is red at the start, and changes to
|
|
768
|
+
* blue when 20% of the total time has elapsed.
|
|
631
769
|
*
|
|
632
770
|
* ```typescript
|
|
633
|
-
* // the provided offset values
|
|
771
|
+
* // the provided offset values
|
|
634
772
|
* animate("5s", keyframes([
|
|
635
773
|
* style({ backgroundColor: "red", offset: 0 }),
|
|
636
774
|
* style({ backgroundColor: "blue", offset: 0.2 }),
|
|
@@ -639,8 +777,8 @@ export declare function state(name: string, styles: AnimationStyleMetadata, opti
|
|
|
639
777
|
* ]))
|
|
640
778
|
* ```
|
|
641
779
|
*
|
|
642
|
-
*
|
|
643
|
-
*
|
|
780
|
+
* If there are no `offset` values specified in the style entries, the offsets
|
|
781
|
+
* are calculated automatically.
|
|
644
782
|
*
|
|
645
783
|
* ```typescript
|
|
646
784
|
* animate("5s", keyframes([
|
|
@@ -649,237 +787,208 @@ export declare function state(name: string, styles: AnimationStyleMetadata, opti
|
|
|
649
787
|
* style({ backgroundColor: "orange" }) // offset = 0.66
|
|
650
788
|
* style({ backgroundColor: "black" }) // offset = 1
|
|
651
789
|
* ]))
|
|
652
|
-
|
|
653
|
-
*
|
|
654
|
-
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
|
655
|
-
*
|
|
656
|
-
* @experimental Animation support is experimental.
|
|
790
|
+
*```
|
|
657
791
|
*/
|
|
658
792
|
export declare function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSequenceMetadata;
|
|
659
793
|
/**
|
|
660
|
-
*
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
* `transition` declares the {@link sequence sequence of animation steps} that will be run when the
|
|
666
|
-
* provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 =>
|
|
667
|
-
* state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting
|
|
668
|
-
* and/or ending state).
|
|
669
|
-
*
|
|
670
|
-
* A function can also be provided as the `stateChangeExpr` argument for a transition and this
|
|
671
|
-
* function will be executed each time a state change occurs. If the value returned within the
|
|
672
|
-
* function is true then the associated animation will be run.
|
|
673
|
-
*
|
|
674
|
-
* Animation transitions are placed within an {@link trigger animation trigger}. For an transition
|
|
675
|
-
* to animate to a state value and persist its styles then one or more {@link state animation
|
|
676
|
-
* states} is expected to be defined.
|
|
794
|
+
* Declares an animation transition as a sequence of animation steps to run when a given
|
|
795
|
+
* condition is satisfied. The condition is a Boolean expression or function that compares
|
|
796
|
+
* the previous and current animation states, and returns true if this transition should occur.
|
|
797
|
+
* When the state criteria of a defined transition are met, the associated animation is
|
|
798
|
+
* triggered.
|
|
677
799
|
*
|
|
678
|
-
*
|
|
800
|
+
* @param stateChangeExpr A Boolean expression or function that compares the previous and current
|
|
801
|
+
* animation states, and returns true if this transition should occur. Note that "true" and "false"
|
|
802
|
+
* match 1 and 0, respectively. An expression is evaluated each time a state change occurs in the
|
|
803
|
+
* animation trigger element.
|
|
804
|
+
* The animation steps run when the expression evaluates to true.
|
|
805
|
+
*
|
|
806
|
+
* - A state-change string takes the form "state1 => state2", where each side is a defined animation
|
|
807
|
+
* state, or an asterix (*) to refer to a dynamic start or end state.
|
|
808
|
+
* - The expression string can contain multiple comma-separated statements;
|
|
809
|
+
* for example "state1 => state2, state3 => state4".
|
|
810
|
+
* - Special values `:enter` and `:leave` initiate a transition on the entry and exit states,
|
|
811
|
+
* equivalent to "void => *" and "* => void".
|
|
812
|
+
* - Special values `:increment` and `:decrement` initiate a transition when a numeric value has
|
|
813
|
+
* increased or decreased in value.
|
|
814
|
+
* - A function is executed each time a state change occurs in the animation trigger element.
|
|
815
|
+
* The animation steps run when the function returns true.
|
|
816
|
+
*
|
|
817
|
+
* @param steps One or more animation objects, as returned by the `animate()` or
|
|
818
|
+
* `sequence()` function, that form a transformation from one state to another.
|
|
819
|
+
* A sequence is used by default when you pass an array.
|
|
820
|
+
* @param options An options object that can contain a delay value for the start of the animation,
|
|
821
|
+
* and additional developer-defined parameters. Provided values for additional parameters are used
|
|
822
|
+
* as defaults, and override values can be passed to the caller on invocation.
|
|
823
|
+
* @returns An object that encapsulates the transition data.
|
|
824
|
+
*
|
|
825
|
+
* @usageNotes
|
|
826
|
+
* The template associated with a component binds an animation trigger to an element.
|
|
827
|
+
*
|
|
828
|
+
* ```HTML
|
|
829
|
+
* <!-- somewhere inside of my-component-tpl.html -->
|
|
830
|
+
* <div [@myAnimationTrigger]="myStatusExp">...</div>
|
|
831
|
+
* ```
|
|
679
832
|
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
* is defined that matches the old/current state criteria then the associated animation will be
|
|
683
|
-
* triggered.
|
|
833
|
+
* All transitions are defined within an animation trigger,
|
|
834
|
+
* along with named states that the transitions change to and from.
|
|
684
835
|
*
|
|
685
836
|
* ```typescript
|
|
686
|
-
* // all transition/state changes are defined within an animation trigger
|
|
687
837
|
* trigger("myAnimationTrigger", [
|
|
688
|
-
*
|
|
689
|
-
*
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
* // a transition animation that will be kicked off when the state value
|
|
694
|
-
* // bound to "myAnimationTrigger" changes from "on" to "off"
|
|
695
|
-
* transition("on => off", animate(500)),
|
|
696
|
-
*
|
|
697
|
-
* // it is also possible to do run the same animation for both directions
|
|
698
|
-
* transition("on <=> off", animate(500)),
|
|
699
|
-
*
|
|
700
|
-
* // or to define multiple states pairs separated by commas
|
|
701
|
-
* transition("on => off, off => void", animate(500)),
|
|
702
|
-
*
|
|
703
|
-
* // this is a catch-all state change for when an element is inserted into
|
|
704
|
-
* // the page and the destination state is unknown
|
|
705
|
-
* transition("void => *", [
|
|
706
|
-
* style({ opacity: 0 }),
|
|
707
|
-
* animate(500)
|
|
708
|
-
* ]),
|
|
838
|
+
* // define states
|
|
839
|
+
* state("on", style({ background: "green" })),
|
|
840
|
+
* state("off", style({ background: "grey" })),
|
|
841
|
+
* ...]
|
|
842
|
+
* ```
|
|
709
843
|
*
|
|
710
|
-
*
|
|
711
|
-
*
|
|
844
|
+
* Note that when you call the `sequence()` function within a `{@link animations/group group()}`
|
|
845
|
+
* or a `transition()` call, execution does not continue to the next instruction
|
|
846
|
+
* until each of the inner animation steps have completed.
|
|
712
847
|
*
|
|
713
|
-
*
|
|
714
|
-
* transition((fromState, toState) => {
|
|
715
|
-
* // when `true` then it will allow the animation below to be invoked
|
|
716
|
-
* return fromState == "off" && toState == "on";
|
|
717
|
-
* }, animate("1s 0s"))
|
|
718
|
-
* ])
|
|
719
|
-
* ```
|
|
848
|
+
* ### Syntax examples
|
|
720
849
|
*
|
|
721
|
-
* The
|
|
722
|
-
*
|
|
850
|
+
* The following examples define transitions between the two defined states (and default states),
|
|
851
|
+
* using various options:
|
|
723
852
|
*
|
|
724
|
-
* ```
|
|
725
|
-
*
|
|
726
|
-
*
|
|
853
|
+
* ```typescript
|
|
854
|
+
* // Transition occurs when the state value
|
|
855
|
+
* // bound to "myAnimationTrigger" changes from "on" to "off"
|
|
856
|
+
* transition("on => off", animate(500))
|
|
857
|
+
* // Run the same animation for both directions
|
|
858
|
+
* transition("on <=> off", animate(500))
|
|
859
|
+
* // Define multiple state-change pairs separated by commas
|
|
860
|
+
* transition("on => off, off => void", animate(500))
|
|
727
861
|
* ```
|
|
728
862
|
*
|
|
729
|
-
*
|
|
863
|
+
* ### Special values for state-change expressions
|
|
730
864
|
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
733
|
-
* for the element to animate itself to the final state. This involves an automatic mix of
|
|
734
|
-
* adding/removing CSS styles so that the element will be in the exact state it should be for the
|
|
735
|
-
* applied state to be presented correctly.
|
|
865
|
+
* - Catch-all state change for when an element is inserted into the page and the
|
|
866
|
+
* destination state is unknown:
|
|
736
867
|
*
|
|
737
|
-
* ```
|
|
738
|
-
* // start off by hiding the element, but make sure that it animates properly to whatever state
|
|
739
|
-
* // is currently active for "myAnimationTrigger"
|
|
868
|
+
* ```typescript
|
|
740
869
|
* transition("void => *", [
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
870
|
+
* style({ opacity: 0 }),
|
|
871
|
+
* animate(500)
|
|
872
|
+
* ])
|
|
744
873
|
* ```
|
|
745
874
|
*
|
|
746
|
-
*
|
|
875
|
+
* - Capture a state change between any states:
|
|
747
876
|
*
|
|
748
|
-
*
|
|
749
|
-
* function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `*
|
|
750
|
-
* => void` state changes.
|
|
877
|
+
* `transition("* => *", animate("1s 0s"))`
|
|
751
878
|
*
|
|
752
|
-
*
|
|
879
|
+
* - Entry and exit transitions:
|
|
880
|
+
*
|
|
881
|
+
* ```typescript
|
|
753
882
|
* transition(":enter", [
|
|
754
883
|
* style({ opacity: 0 }),
|
|
755
884
|
* animate(500, style({ opacity: 1 }))
|
|
756
|
-
*
|
|
885
|
+
* ]),
|
|
757
886
|
* transition(":leave", [
|
|
758
887
|
* animate(500, style({ opacity: 0 }))
|
|
759
|
-
*
|
|
888
|
+
* ])
|
|
760
889
|
* ```
|
|
761
890
|
*
|
|
762
|
-
*
|
|
763
|
-
* if a trigger binding value is a boolean value then it can be matched using a transition
|
|
764
|
-
* expression that compares `true` and `false` or `1` and `0`.
|
|
891
|
+
* - Use `:increment` and `:decrement` to initiate transitions:
|
|
765
892
|
*
|
|
766
|
-
* ```
|
|
767
|
-
*
|
|
768
|
-
*
|
|
893
|
+
* ```typescript
|
|
894
|
+
* transition(":increment", group([
|
|
895
|
+
* query(':enter', [
|
|
896
|
+
* style({ left: '100%' }),
|
|
897
|
+
* animate('0.5s ease-out', style('*'))
|
|
898
|
+
* ]),
|
|
899
|
+
* query(':leave', [
|
|
900
|
+
* animate('0.5s ease-out', style({ left: '-100%' }))
|
|
901
|
+
* ])
|
|
902
|
+
* ]))
|
|
769
903
|
*
|
|
770
|
-
*
|
|
771
|
-
*
|
|
772
|
-
*
|
|
773
|
-
*
|
|
774
|
-
*
|
|
775
|
-
*
|
|
904
|
+
* transition(":decrement", group([
|
|
905
|
+
* query(':enter', [
|
|
906
|
+
* style({ left: '100%' }),
|
|
907
|
+
* animate('0.5s ease-out', style('*'))
|
|
908
|
+
* ]),
|
|
909
|
+
* query(':leave', [
|
|
910
|
+
* animate('0.5s ease-out', style({ left: '-100%' }))
|
|
911
|
+
* ])
|
|
912
|
+
* ]))
|
|
776
913
|
* ```
|
|
777
914
|
*
|
|
778
|
-
* ###
|
|
779
|
-
*
|
|
780
|
-
*
|
|
915
|
+
* ### State-change functions
|
|
916
|
+
*
|
|
917
|
+
* Here is an example of a `fromState` specified as a state-change function that invokes an
|
|
918
|
+
* animation when true:
|
|
781
919
|
*
|
|
920
|
+
* ```typescript
|
|
921
|
+
* transition((fromState, toState) =>
|
|
922
|
+
* {
|
|
923
|
+
* return fromState == "off" && toState == "on";
|
|
924
|
+
* },
|
|
925
|
+
* animate("1s 0s"))
|
|
782
926
|
* ```
|
|
783
|
-
* import {group, animate, query, transition, style, trigger} from '@angular/animations';
|
|
784
|
-
* import {Component} from '@angular/core';
|
|
785
927
|
*
|
|
786
|
-
*
|
|
787
|
-
* selector: 'banner-carousel-component',
|
|
788
|
-
* styles: [`
|
|
789
|
-
* .banner-container {
|
|
790
|
-
* position:relative;
|
|
791
|
-
* height:500px;
|
|
792
|
-
* overflow:hidden;
|
|
793
|
-
* }
|
|
794
|
-
* .banner-container > .banner {
|
|
795
|
-
* position:absolute;
|
|
796
|
-
* left:0;
|
|
797
|
-
* top:0;
|
|
798
|
-
* font-size:200px;
|
|
799
|
-
* line-height:500px;
|
|
800
|
-
* font-weight:bold;
|
|
801
|
-
* text-align:center;
|
|
802
|
-
* width:100%;
|
|
803
|
-
* }
|
|
804
|
-
* `],
|
|
805
|
-
* template: `
|
|
806
|
-
* <button (click)="previous()">Previous</button>
|
|
807
|
-
* <button (click)="next()">Next</button>
|
|
808
|
-
* <hr>
|
|
809
|
-
* <div [@bannerAnimation]="selectedIndex" class="banner-container">
|
|
810
|
-
* <div class="banner" *ngFor="let banner of banners"> {{ banner }} </div>
|
|
811
|
-
* </div>
|
|
812
|
-
* `,
|
|
813
|
-
* animations: [
|
|
814
|
-
* trigger('bannerAnimation', [
|
|
815
|
-
* transition(":increment", group([
|
|
816
|
-
* query(':enter', [
|
|
817
|
-
* style({ left: '100%' }),
|
|
818
|
-
* animate('0.5s ease-out', style('*'))
|
|
819
|
-
* ]),
|
|
820
|
-
* query(':leave', [
|
|
821
|
-
* animate('0.5s ease-out', style({ left: '-100%' }))
|
|
822
|
-
* ])
|
|
823
|
-
* ])),
|
|
824
|
-
* transition(":decrement", group([
|
|
825
|
-
* query(':enter', [
|
|
826
|
-
* style({ left: '-100%' }),
|
|
827
|
-
* animate('0.5s ease-out', style('*'))
|
|
828
|
-
* ]),
|
|
829
|
-
* query(':leave', [
|
|
830
|
-
* animate('0.5s ease-out', style({ left: '100%' }))
|
|
831
|
-
* ])
|
|
832
|
-
* ]))
|
|
833
|
-
* ])
|
|
834
|
-
* ]
|
|
835
|
-
* })
|
|
836
|
-
* class BannerCarouselComponent {
|
|
837
|
-
* allBanners: string[] = ['1', '2', '3', '4'];
|
|
838
|
-
* selectedIndex: number = 0;
|
|
928
|
+
* ### Animating to the final state
|
|
839
929
|
*
|
|
840
|
-
*
|
|
841
|
-
*
|
|
842
|
-
*
|
|
930
|
+
* If the final step in a transition is a call to `animate()` that uses a timing value
|
|
931
|
+
* with no style data, that step is automatically considered the final animation arc,
|
|
932
|
+
* for the element to reach the final state. Angular automatically adds or removes
|
|
933
|
+
* CSS styles to ensure that the element is in the correct final state.
|
|
843
934
|
*
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
* }
|
|
935
|
+
* The following example defines a transition that starts by hiding the element,
|
|
936
|
+
* then makes sure that it animates properly to whatever state is currently active for trigger:
|
|
847
937
|
*
|
|
848
|
-
*
|
|
849
|
-
*
|
|
850
|
-
* }
|
|
851
|
-
*
|
|
938
|
+
* ```typescript
|
|
939
|
+
* transition("void => *", [
|
|
940
|
+
* style({ opacity: 0 }),
|
|
941
|
+
* animate(500)
|
|
942
|
+
* ])
|
|
852
943
|
* ```
|
|
944
|
+
* ### Boolean value matching
|
|
945
|
+
* If a trigger binding value is a Boolean, it can be matched using a transition expression
|
|
946
|
+
* that compares true and false or 1 and 0. For example:
|
|
853
947
|
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
* @
|
|
857
|
-
|
|
948
|
+
* ```
|
|
949
|
+
* // in the template
|
|
950
|
+
* <div [@openClose]="open ? true : false">...</div>
|
|
951
|
+
* // in the component metadata
|
|
952
|
+
* trigger('openClose', [
|
|
953
|
+
* state('true', style({ height: '*' })),
|
|
954
|
+
* state('false', style({ height: '0px' })),
|
|
955
|
+
* transition('false <=> true', animate(500))
|
|
956
|
+
* ])
|
|
957
|
+
* ```
|
|
958
|
+
**/
|
|
858
959
|
export declare function transition(stateChangeExpr: string | ((fromState: string, toState: string, element?: any, params?: {
|
|
859
960
|
[key: string]: any;
|
|
860
961
|
}) => boolean), steps: AnimationMetadata | AnimationMetadata[], options?: AnimationOptions | null): AnimationTransitionMetadata;
|
|
861
962
|
/**
|
|
862
|
-
*
|
|
863
|
-
*
|
|
864
|
-
*
|
|
865
|
-
*
|
|
866
|
-
*
|
|
867
|
-
*
|
|
963
|
+
* Produces a reusable animation that can be invoked in another animation or sequence,
|
|
964
|
+
* by calling the `useAnimation()` function.
|
|
965
|
+
*
|
|
966
|
+
* @param steps One or more animation objects, as returned by the `animate()`
|
|
967
|
+
* or `sequence()` function, that form a transformation from one state to another.
|
|
968
|
+
* A sequence is used by default when you pass an array.
|
|
969
|
+
* @param options An options object that can contain a delay value for the start of the
|
|
970
|
+
* animation, and additional developer-defined parameters.
|
|
971
|
+
* Provided values for additional parameters are used as defaults,
|
|
972
|
+
* and override values can be passed to the caller on invocation.
|
|
973
|
+
* @returns An object that encapsulates the animation data.
|
|
974
|
+
*
|
|
975
|
+
* @usageNotes
|
|
976
|
+
* The following example defines a reusable animation, providing some default parameter
|
|
977
|
+
* values.
|
|
868
978
|
*
|
|
869
|
-
* ```
|
|
979
|
+
* ```typescript
|
|
870
980
|
* var fadeAnimation = animation([
|
|
871
981
|
* style({ opacity: '{{ start }}' }),
|
|
872
982
|
* animate('{{ time }}',
|
|
873
|
-
*
|
|
874
|
-
*
|
|
983
|
+
* style({ opacity: '{{ end }}'}))
|
|
984
|
+
* ],
|
|
985
|
+
* { params: { time: '1000ms', start: 0, end: 1 }});
|
|
875
986
|
* ```
|
|
876
987
|
*
|
|
877
|
-
*
|
|
878
|
-
*
|
|
879
|
-
* directly. If any of the passed in parameter values are missing then the default values will be
|
|
880
|
-
* used.
|
|
988
|
+
* The following invokes the defined animation with a call to `useAnimation()`,
|
|
989
|
+
* passing in override parameter values.
|
|
881
990
|
*
|
|
882
|
-
* ```
|
|
991
|
+
* ```js
|
|
883
992
|
* useAnimation(fadeAnimation, {
|
|
884
993
|
* params: {
|
|
885
994
|
* time: '2s',
|
|
@@ -889,131 +998,66 @@ export declare function transition(stateChangeExpr: string | ((fromState: string
|
|
|
889
998
|
* })
|
|
890
999
|
* ```
|
|
891
1000
|
*
|
|
892
|
-
* If
|
|
893
|
-
*
|
|
894
|
-
*
|
|
1001
|
+
* If any of the passed-in parameter values are missing from this call,
|
|
1002
|
+
* the default values are used. If one or more parameter values are missing before a step is
|
|
1003
|
+
* animated, `useAnimation()` throws an error.
|
|
895
1004
|
*/
|
|
896
1005
|
export declare function animation(steps: AnimationMetadata | AnimationMetadata[], options?: AnimationOptions | null): AnimationReferenceMetadata;
|
|
897
1006
|
/**
|
|
898
|
-
*
|
|
899
|
-
* animation DSL language. It works by allowing a queried element to execute its own
|
|
900
|
-
* animation within the animation sequence.
|
|
901
|
-
*
|
|
902
|
-
* Each time an animation is triggered in angular, the parent animation
|
|
903
|
-
* will always get priority and any child animations will be blocked. In order
|
|
904
|
-
* for a child animation to run, the parent animation must query each of the elements
|
|
905
|
-
* containing child animations and then allow the animations to run using `animateChild`.
|
|
906
|
-
*
|
|
907
|
-
* The example HTML code below shows both parent and child elements that have animation
|
|
908
|
-
* triggers that will execute at the same time.
|
|
909
|
-
*
|
|
910
|
-
* ```html
|
|
911
|
-
* <!-- parent-child.component.html -->
|
|
912
|
-
* <button (click)="exp =! exp">Toggle</button>
|
|
913
|
-
* <hr>
|
|
914
|
-
*
|
|
915
|
-
* <div [@parentAnimation]="exp">
|
|
916
|
-
* <header>Hello</header>
|
|
917
|
-
* <div [@childAnimation]="exp">
|
|
918
|
-
* one
|
|
919
|
-
* </div>
|
|
920
|
-
* <div [@childAnimation]="exp">
|
|
921
|
-
* two
|
|
922
|
-
* </div>
|
|
923
|
-
* <div [@childAnimation]="exp">
|
|
924
|
-
* three
|
|
925
|
-
* </div>
|
|
926
|
-
* </div>
|
|
927
|
-
* ```
|
|
1007
|
+
* Executes a queried inner animation element within an animation sequence.
|
|
928
1008
|
*
|
|
929
|
-
*
|
|
930
|
-
*
|
|
931
|
-
*
|
|
1009
|
+
* @param options An options object that can contain a delay value for the start of the
|
|
1010
|
+
* animation, and additional override values for developer-defined parameters.
|
|
1011
|
+
* @return An object that encapsulates the child animation data.
|
|
932
1012
|
*
|
|
933
|
-
*
|
|
934
|
-
*
|
|
935
|
-
*
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
* animations: [
|
|
939
|
-
* trigger('parentAnimation', [
|
|
940
|
-
* transition('false => true', [
|
|
941
|
-
* query('header', [
|
|
942
|
-
* style({ opacity: 0 }),
|
|
943
|
-
* animate(500, style({ opacity: 1 }))
|
|
944
|
-
* ]),
|
|
945
|
-
* query('@childAnimation', [
|
|
946
|
-
* animateChild()
|
|
947
|
-
* ])
|
|
948
|
-
* ])
|
|
949
|
-
* ]),
|
|
950
|
-
* trigger('childAnimation', [
|
|
951
|
-
* transition('false => true', [
|
|
952
|
-
* style({ opacity: 0 }),
|
|
953
|
-
* animate(500, style({ opacity: 1 }))
|
|
954
|
-
* ])
|
|
955
|
-
* ])
|
|
956
|
-
* ]
|
|
957
|
-
* })
|
|
958
|
-
* class ParentChildCmp {
|
|
959
|
-
* exp: boolean = false;
|
|
960
|
-
* }
|
|
961
|
-
* ```
|
|
962
|
-
*
|
|
963
|
-
* In the animation code above, when the `parentAnimation` transition kicks off it first queries to
|
|
964
|
-
* find the header element and fades it in. It then finds each of the sub elements that contain the
|
|
965
|
-
* `@childAnimation` trigger and then allows for their animations to fire.
|
|
966
|
-
*
|
|
967
|
-
* This example can be further extended by using stagger:
|
|
968
|
-
*
|
|
969
|
-
* ```ts
|
|
970
|
-
* query('@childAnimation', stagger(100, [
|
|
971
|
-
* animateChild()
|
|
972
|
-
* ]))
|
|
973
|
-
* ```
|
|
974
|
-
*
|
|
975
|
-
* Now each of the sub animations start off with respect to the `100ms` staggering step.
|
|
976
|
-
*
|
|
977
|
-
* ## The first frame of child animations
|
|
978
|
-
* When sub animations are executed using `animateChild` the animation engine will always apply the
|
|
979
|
-
* first frame of every sub animation immediately at the start of the animation sequence. This way
|
|
980
|
-
* the parent animation does not need to set any initial styling data on the sub elements before the
|
|
981
|
-
* sub animations kick off.
|
|
982
|
-
*
|
|
983
|
-
* In the example above the first frame of the `childAnimation`'s `false => true` transition
|
|
984
|
-
* consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation`
|
|
985
|
-
* animation transition sequence starts. Only then when the `@childAnimation` is queried and called
|
|
986
|
-
* with `animateChild` will it then animate to its destination of `opacity: 1`.
|
|
987
|
-
*
|
|
988
|
-
* Note that this feature designed to be used alongside {@link query query()} and it will only work
|
|
989
|
-
* with animations that are assigned using the Angular animation DSL (this means that CSS keyframes
|
|
990
|
-
* and transitions are not handled by this API).
|
|
1013
|
+
* @usageNotes
|
|
1014
|
+
* Each time an animation is triggered in Angular, the parent animation
|
|
1015
|
+
* has priority and any child animations are blocked. In order
|
|
1016
|
+
* for a child animation to run, the parent animation must query each of the elements
|
|
1017
|
+
* containing child animations, and run them using this function.
|
|
991
1018
|
*
|
|
992
|
-
*
|
|
1019
|
+
* Note that this feature designed to be used with `query()` and it will only work
|
|
1020
|
+
* with animations that are assigned using the Angular animation library. CSS keyframes
|
|
1021
|
+
* and transitions are not handled by this API.
|
|
993
1022
|
*/
|
|
994
1023
|
export declare function animateChild(options?: AnimateChildOptions | null): AnimationAnimateChildMetadata;
|
|
995
1024
|
/**
|
|
996
|
-
*
|
|
997
|
-
* animation DSL language. It is used to kick off a reusable animation that is created using {@link
|
|
998
|
-
* animation animation()}.
|
|
1025
|
+
* Starts a reusable animation that is created using the `animation()` function.
|
|
999
1026
|
*
|
|
1000
|
-
* @
|
|
1027
|
+
* @param animation The reusable animation to start.
|
|
1028
|
+
* @param options An options object that can contain a delay value for the start of
|
|
1029
|
+
* the animation, and additional override values for developer-defined parameters.
|
|
1030
|
+
* @return An object that contains the animation parameters.
|
|
1001
1031
|
*/
|
|
1002
1032
|
export declare function useAnimation(animation: AnimationReferenceMetadata, options?: AnimationOptions | null): AnimationAnimateRefMetadata;
|
|
1003
1033
|
/**
|
|
1004
|
-
*
|
|
1005
|
-
*
|
|
1006
|
-
*
|
|
1007
|
-
*
|
|
1008
|
-
*
|
|
1009
|
-
*
|
|
1010
|
-
*
|
|
1034
|
+
* Finds one or more inner elements within the current element that is
|
|
1035
|
+
* being animated within a sequence. Use with `animateChild()`.
|
|
1036
|
+
*
|
|
1037
|
+
* @param selector The element to query, or a set of elements that contain Angular-specific
|
|
1038
|
+
* characteristics, specified with one or more of the following tokens.
|
|
1039
|
+
* - `query(":enter")` or `query(":leave")` : Query for newly inserted/removed elements.
|
|
1040
|
+
* - `query(":animating")` : Query all currently animating elements.
|
|
1041
|
+
* - `query("@triggerName")` : Query elements that contain an animation trigger.
|
|
1042
|
+
* - `query("@*")` : Query all elements that contain an animation triggers.
|
|
1043
|
+
* - `query(":self")` : Include the current element into the animation sequence.
|
|
1044
|
+
*
|
|
1045
|
+
* @param animation One or more animation steps to apply to the queried element or elements.
|
|
1046
|
+
* An array is treated as an animation sequence.
|
|
1047
|
+
* @param options An options object. Use the 'limit' field to limit the total number of
|
|
1048
|
+
* items to collect.
|
|
1049
|
+
* @return An object that encapsulates the query data.
|
|
1050
|
+
*
|
|
1051
|
+
* @usageNotes
|
|
1052
|
+
* Tokens can be merged into a combined query selector string. For example:
|
|
1011
1053
|
*
|
|
1012
|
-
*
|
|
1054
|
+
* ```typescript
|
|
1055
|
+
* query(':self, .record:enter, .record:leave, @subTrigger', [...])
|
|
1056
|
+
* ```
|
|
1013
1057
|
*
|
|
1014
|
-
* query()
|
|
1015
|
-
* `element.querySelectorAll`.
|
|
1016
|
-
*
|
|
1058
|
+
* The `query()` function collects multiple elements and works internally by using
|
|
1059
|
+
* `element.querySelectorAll`. Use the `limit` field of an options object to limit
|
|
1060
|
+
* the total number of items to be collected. For example:
|
|
1017
1061
|
*
|
|
1018
1062
|
* ```js
|
|
1019
1063
|
* query('div', [
|
|
@@ -1022,8 +1066,8 @@ export declare function useAnimation(animation: AnimationReferenceMetadata, opti
|
|
|
1022
1066
|
* ], { limit: 1 })
|
|
1023
1067
|
* ```
|
|
1024
1068
|
*
|
|
1025
|
-
*
|
|
1026
|
-
*
|
|
1069
|
+
* By default, throws an error when zero items are found. Set the
|
|
1070
|
+
* `optional` flag to ignore this error. For example:
|
|
1027
1071
|
*
|
|
1028
1072
|
* ```js
|
|
1029
1073
|
* query('.some-element-that-may-not-be-there', [
|
|
@@ -1032,31 +1076,12 @@ export declare function useAnimation(animation: AnimationReferenceMetadata, opti
|
|
|
1032
1076
|
* ], { optional: true })
|
|
1033
1077
|
* ```
|
|
1034
1078
|
*
|
|
1035
|
-
* ###
|
|
1036
|
-
*
|
|
1037
|
-
* The selector value within a query can collect elements that contain angular-specific
|
|
1038
|
-
* characteristics
|
|
1039
|
-
* using special pseudo-selectors tokens.
|
|
1079
|
+
* ### Usage Example
|
|
1040
1080
|
*
|
|
1041
|
-
*
|
|
1081
|
+
* The following example queries for inner elements and animates them
|
|
1082
|
+
* individually using `animateChild()`.
|
|
1042
1083
|
*
|
|
1043
|
-
*
|
|
1044
|
-
* - Querying all currently animating elements using `query(":animating")`
|
|
1045
|
-
* - Querying elements that contain an animation trigger using `query("@triggerName")`
|
|
1046
|
-
* - Querying all elements that contain an animation triggers using `query("@*")`
|
|
1047
|
-
* - Including the current element into the animation sequence using `query(":self")`
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1050
|
-
* Each of these pseudo-selector tokens can be merged together into a combined query selector
|
|
1051
|
-
* string:
|
|
1052
|
-
*
|
|
1053
|
-
* ```
|
|
1054
|
-
* query(':self, .record:enter, .record:leave, @subTrigger', [...])
|
|
1055
|
-
* ```
|
|
1056
|
-
*
|
|
1057
|
-
* ### Demo
|
|
1058
|
-
*
|
|
1059
|
-
* ```
|
|
1084
|
+
* ```typescript
|
|
1060
1085
|
* @Component({
|
|
1061
1086
|
* selector: 'inner',
|
|
1062
1087
|
* template: `
|
|
@@ -1089,21 +1114,26 @@ export declare function useAnimation(animation: AnimationReferenceMetadata, opti
|
|
|
1089
1114
|
* }
|
|
1090
1115
|
* }
|
|
1091
1116
|
* ```
|
|
1092
|
-
*
|
|
1093
|
-
* @experimental Animation support is experimental.
|
|
1094
1117
|
*/
|
|
1095
1118
|
export declare function query(selector: string, animation: AnimationMetadata | AnimationMetadata[], options?: AnimationQueryOptions | null): AnimationQueryMetadata;
|
|
1096
1119
|
/**
|
|
1097
|
-
*
|
|
1098
|
-
*
|
|
1099
|
-
* and works by issuing a timing gap between after each queried item is animated.
|
|
1120
|
+
* Use within an animation `query()` call to issue a timing gap after
|
|
1121
|
+
* each queried item is animated.
|
|
1100
1122
|
*
|
|
1101
|
-
*
|
|
1123
|
+
* @param timings A delay value.
|
|
1124
|
+
* @param animation One ore more animation steps.
|
|
1125
|
+
* @returns An object that encapsulates the stagger data.
|
|
1102
1126
|
*
|
|
1103
|
-
*
|
|
1104
|
-
*
|
|
1127
|
+
* @usageNotes
|
|
1128
|
+
* In the following example, a container element wraps a list of items stamped out
|
|
1129
|
+
* by an `ngFor`. The container element contains an animation trigger that will later be set
|
|
1105
1130
|
* to query for each of the inner items.
|
|
1106
1131
|
*
|
|
1132
|
+
* Each time items are added, the opacity fade-in animation runs,
|
|
1133
|
+
* and each removed item is faded out.
|
|
1134
|
+
* When either of these animations occur, the stagger effect is
|
|
1135
|
+
* applied after each item's animation is started.
|
|
1136
|
+
*
|
|
1107
1137
|
* ```html
|
|
1108
1138
|
* <!-- list.component.html -->
|
|
1109
1139
|
* <button (click)="toggle()">Show / Hide Items</button>
|
|
@@ -1115,15 +1145,15 @@ export declare function query(selector: string, animation: AnimationMetadata | A
|
|
|
1115
1145
|
* </div>
|
|
1116
1146
|
* ```
|
|
1117
1147
|
*
|
|
1118
|
-
*
|
|
1148
|
+
* Here is the component code:
|
|
1119
1149
|
*
|
|
1120
|
-
* ```
|
|
1150
|
+
* ```typescript
|
|
1121
1151
|
* import {trigger, transition, style, animate, query, stagger} from '@angular/animations';
|
|
1122
1152
|
* @Component({
|
|
1123
1153
|
* templateUrl: 'list.component.html',
|
|
1124
1154
|
* animations: [
|
|
1125
1155
|
* trigger('listAnimation', [
|
|
1126
|
-
*
|
|
1156
|
+
* ...
|
|
1127
1157
|
* ])
|
|
1128
1158
|
* ]
|
|
1129
1159
|
* })
|
|
@@ -1140,13 +1170,13 @@ export declare function query(selector: string, animation: AnimationMetadata | A
|
|
|
1140
1170
|
*
|
|
1141
1171
|
* toggle() {
|
|
1142
1172
|
* this.items.length ? this.hideItems() : this.showItems();
|
|
1143
|
-
*
|
|
1144
|
-
*
|
|
1173
|
+
* }
|
|
1174
|
+
* }
|
|
1145
1175
|
* ```
|
|
1146
1176
|
*
|
|
1147
|
-
*
|
|
1177
|
+
* Here is the animation trigger code:
|
|
1148
1178
|
*
|
|
1149
|
-
* ```
|
|
1179
|
+
* ```typescript
|
|
1150
1180
|
* trigger('listAnimation', [
|
|
1151
1181
|
* transition('* => *', [ // each time the binding value changes
|
|
1152
1182
|
* query(':leave', [
|
|
@@ -1163,12 +1193,5 @@ export declare function query(selector: string, animation: AnimationMetadata | A
|
|
|
1163
1193
|
* ])
|
|
1164
1194
|
* ])
|
|
1165
1195
|
* ```
|
|
1166
|
-
*
|
|
1167
|
-
* Now each time the items are added/removed then either the opacity
|
|
1168
|
-
* fade-in animation will run or each removed item will be faded out.
|
|
1169
|
-
* When either of these animations occur then a stagger effect will be
|
|
1170
|
-
* applied after each item's animation is started.
|
|
1171
|
-
*
|
|
1172
|
-
* @experimental Animation support is experimental.
|
|
1173
1196
|
*/
|
|
1174
1197
|
export declare function stagger(timings: string | number, animation: AnimationMetadata | AnimationMetadata[]): AnimationStaggerMetadata;
|