UNPKG

7.89 kBTypeScriptView Raw
1import { Platform } from '../platform/platform';
2/**
3 * @hidden
4 */
5export declare class Animation {
6 private _c;
7 private _cL;
8 private _e;
9 private _eL;
10 private _fx;
11 private _dur;
12 private _es;
13 private _rvEs;
14 private _bfSty;
15 private _bfAdd;
16 private _bfRm;
17 private _afSty;
18 private _afAdd;
19 private _afRm;
20 private _rdFn;
21 private _wrFn;
22 private _fFn;
23 private _fOneFn;
24 private _rv;
25 private _unrgTrns;
26 private _tm;
27 private _hasDur;
28 private _isAsync;
29 private _twn;
30 plt: Platform;
31 parent: Animation;
32 opts: AnimationOptions;
33 hasChildren: boolean;
34 isPlaying: boolean;
35 hasCompleted: boolean;
36 constructor(plt: Platform, ele?: any, opts?: AnimationOptions);
37 element(ele: any): Animation;
38 /**
39 * NO DOM
40 */
41 private _addEle(ele);
42 /**
43 * Add a child animation to this animation.
44 */
45 add(childAnimation: Animation): Animation;
46 /**
47 * Get the duration of this animation. If this animation does
48 * not have a duration, then it'll get the duration from its parent.
49 */
50 getDuration(opts?: PlayOptions): number;
51 /**
52 * Returns if the animation is a root one.
53 */
54 isRoot(): boolean;
55 /**
56 * Set the duration for this animation.
57 */
58 duration(milliseconds: number): Animation;
59 /**
60 * Get the easing of this animation. If this animation does
61 * not have an easing, then it'll get the easing from its parent.
62 */
63 getEasing(): string;
64 /**
65 * Set the easing for this animation.
66 */
67 easing(name: string): Animation;
68 /**
69 * Set the easing for this reversed animation.
70 */
71 easingReverse(name: string): Animation;
72 /**
73 * Add the "from" value for a specific property.
74 */
75 from(prop: string, val: any): Animation;
76 /**
77 * Add the "to" value for a specific property.
78 */
79 to(prop: string, val: any, clearProperyAfterTransition?: boolean): Animation;
80 /**
81 * Shortcut to add both the "from" and "to" for the same property.
82 */
83 fromTo(prop: string, fromVal: any, toVal: any, clearProperyAfterTransition?: boolean): Animation;
84 /**
85 * @hidden
86 * NO DOM
87 */
88 private _getProp(name);
89 private _addProp(state, prop, val);
90 /**
91 * Add CSS class to this animation's elements
92 * before the animation begins.
93 */
94 beforeAddClass(className: string): Animation;
95 /**
96 * Remove CSS class from this animation's elements
97 * before the animation begins.
98 */
99 beforeRemoveClass(className: string): Animation;
100 /**
101 * Set CSS inline styles to this animation's elements
102 * before the animation begins.
103 */
104 beforeStyles(styles: {
105 [property: string]: any;
106 }): Animation;
107 /**
108 * Clear CSS inline styles from this animation's elements
109 * before the animation begins.
110 */
111 beforeClearStyles(propertyNames: string[]): Animation;
112 /**
113 * Add a function which contains DOM reads, which will run
114 * before the animation begins.
115 */
116 beforeAddRead(domReadFn: Function): Animation;
117 /**
118 * Add a function which contains DOM writes, which will run
119 * before the animation begins.
120 */
121 beforeAddWrite(domWriteFn: Function): Animation;
122 /**
123 * Add CSS class to this animation's elements
124 * after the animation finishes.
125 */
126 afterAddClass(className: string): Animation;
127 /**
128 * Remove CSS class from this animation's elements
129 * after the animation finishes.
130 */
131 afterRemoveClass(className: string): Animation;
132 /**
133 * Set CSS inline styles to this animation's elements
134 * after the animation finishes.
135 */
136 afterStyles(styles: {
137 [property: string]: any;
138 }): Animation;
139 /**
140 * Clear CSS inline styles from this animation's elements
141 * after the animation finishes.
142 */
143 afterClearStyles(propertyNames: string[]): Animation;
144 /**
145 * Play the animation.
146 */
147 play(opts?: PlayOptions): void;
148 syncPlay(): void;
149 /**
150 * @hidden
151 * DOM WRITE
152 * RECURSION
153 */
154 _playInit(opts: PlayOptions): void;
155 /**
156 * @hidden
157 * DOM WRITE
158 * NO RECURSION
159 * ROOT ANIMATION
160 */
161 _playDomInspect(opts: PlayOptions): void;
162 /**
163 * @hidden
164 * DOM WRITE
165 * RECURSION
166 */
167 _playProgress(opts: PlayOptions): void;
168 /**
169 * @hidden
170 * DOM WRITE
171 * RECURSION
172 */
173 _playToStep(stepValue: number): void;
174 /**
175 * @hidden
176 * DOM WRITE
177 * NO RECURSION
178 * ROOT ANIMATION
179 */
180 _asyncEnd(dur: number, shouldComplete: boolean): void;
181 /**
182 * @hidden
183 * DOM WRITE
184 * RECURSION
185 */
186 _playEnd(stepValue?: number): void;
187 /**
188 * @hidden
189 * NO DOM
190 * RECURSION
191 */
192 _hasDuration(opts: PlayOptions): boolean;
193 /**
194 * @hidden
195 * NO DOM
196 * RECURSION
197 */
198 _hasDomReads(): boolean;
199 /**
200 * Immediately stop at the end of the animation.
201 */
202 stop(stepValue?: number): void;
203 /**
204 * @hidden
205 * NO DOM
206 * NO RECURSION
207 */
208 _clearAsync(): void;
209 /**
210 * @hidden
211 * DOM WRITE
212 * NO RECURSION
213 */
214 _progress(stepValue: number): void;
215 /**
216 * @hidden
217 * DOM WRITE
218 * NO RECURSION
219 */
220 _setTrans(dur: number, forcedLinearEasing: boolean): void;
221 /**
222 * @hidden
223 * DOM READ
224 * DOM WRITE
225 * RECURSION
226 */
227 _beforeAnimation(): void;
228 /**
229 * @hidden
230 * DOM WRITE
231 * RECURSION
232 */
233 _setBeforeStyles(): void;
234 /**
235 * @hidden
236 * DOM READ
237 * RECURSION
238 */
239 _fireBeforeReadFunc(): void;
240 /**
241 * @hidden
242 * DOM WRITE
243 * RECURSION
244 */
245 _fireBeforeWriteFunc(): void;
246 /**
247 * @hidden
248 * DOM WRITE
249 */
250 _setAfterStyles(): void;
251 /**
252 * @hidden
253 * DOM WRITE
254 * NO RECURSION
255 */
256 _willChg(addWillChange: boolean): void;
257 /**
258 * Start the animation with a user controlled progress.
259 */
260 progressStart(): void;
261 /**
262 * @hidden
263 * DOM WRITE
264 * RECURSION
265 */
266 _progressStart(): void;
267 /**
268 * Set the progress step for this animation.
269 * progressStep() is not debounced, so it should not be called faster than 60FPS.
270 */
271 progressStep(stepValue: number): void;
272 /**
273 * End the progress animation.
274 */
275 progressEnd(shouldComplete: boolean, currentStepValue: number, dur?: number): void;
276 /**
277 * @hidden
278 * DOM WRITE
279 * RECURSION
280 */
281 _progressEnd(shouldComplete: boolean, stepValue: number, dur: number, isAsync: boolean): void;
282 /**
283 * Add a callback to fire when the animation has finished.
284 */
285 onFinish(callback: Function, onceTimeCallback?: boolean, clearOnFinishCallacks?: boolean): Animation;
286 /**
287 * @hidden
288 * NO DOM
289 * RECURSION
290 */
291 _didFinishAll(hasCompleted: boolean, finishAsyncAnimations: boolean, finishNoDurationAnimations: boolean): void;
292 /**
293 * @hidden
294 * NO RECURSION
295 */
296 _didFinish(hasCompleted: boolean): void;
297 /**
298 * Reverse the animation.
299 */
300 reverse(shouldReverse?: boolean): Animation;
301 /**
302 * Recursively destroy this animation and all child animations.
303 */
304 destroy(): void;
305 /**
306 * @hidden
307 * NO DOM
308 */
309 _transEl(): HTMLElement;
310}
311export interface AnimationOptions {
312 animation?: string;
313 duration?: number;
314 easing?: string;
315 direction?: string;
316 isRTL?: boolean;
317 ev?: any;
318}
319export interface PlayOptions {
320 duration?: number;
321}
322export interface EffectProperty {
323 name: string;
324 trans: boolean;
325 wc?: string;
326 to?: EffectState;
327 from?: EffectState;
328}
329export interface EffectState {
330 val: any;
331 num: number;
332 unit: string;
333}