1 | 'use strict';
|
2 | import type { BaseAnimationBuilder } from '../animationBuilder';
|
3 | import { ComplexAnimationBuilder } from '../animationBuilder';
|
4 | import type {
|
5 | EntryAnimationsValues,
|
6 | ExitAnimationsValues,
|
7 | AnimationConfigFunction,
|
8 | IEntryAnimationBuilder,
|
9 | IExitAnimationBuilder,
|
10 | } from '../animationBuilder/commonTypes';
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | export class RotateInDownLeft
|
20 | extends ComplexAnimationBuilder
|
21 | implements IEntryAnimationBuilder
|
22 | {
|
23 | static presetName = 'RotateInDownLeft';
|
24 |
|
25 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
26 | this: T
|
27 | ): InstanceType<T> {
|
28 | return new RotateInDownLeft() as InstanceType<T>;
|
29 | }
|
30 |
|
31 | build = (): AnimationConfigFunction<EntryAnimationsValues> => {
|
32 | const delayFunction = this.getDelayFunction();
|
33 | const [animation, config] = this.getAnimationAndConfig();
|
34 | const delay = this.getDelay();
|
35 | const callback = this.callbackV;
|
36 | const initialValues = this.initialValues;
|
37 |
|
38 | return (values) => {
|
39 | 'worklet';
|
40 | return {
|
41 | animations: {
|
42 | opacity: delayFunction(delay, animation(1, config)),
|
43 | transform: [
|
44 | { rotate: delayFunction(delay, animation('0deg', config)) },
|
45 | { translateX: delayFunction(delay, animation(0, config)) },
|
46 | { translateY: delayFunction(delay, animation(0, config)) },
|
47 | ],
|
48 | },
|
49 | initialValues: {
|
50 | opacity: 0,
|
51 | transform: [
|
52 | { rotate: '-90deg' },
|
53 | { translateX: values.targetWidth / 2 - values.targetHeight / 2 },
|
54 | { translateY: -(values.targetWidth / 2 - values.targetHeight / 2) },
|
55 | ],
|
56 | ...initialValues,
|
57 | },
|
58 | callback,
|
59 | };
|
60 | };
|
61 | };
|
62 | }
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | export class RotateInDownRight
|
72 | extends ComplexAnimationBuilder
|
73 | implements IEntryAnimationBuilder
|
74 | {
|
75 | static presetName = 'RotateInDownRight';
|
76 |
|
77 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
78 | this: T
|
79 | ): InstanceType<T> {
|
80 | return new RotateInDownRight() as InstanceType<T>;
|
81 | }
|
82 |
|
83 | build = (): AnimationConfigFunction<EntryAnimationsValues> => {
|
84 | const delayFunction = this.getDelayFunction();
|
85 | const [animation, config] = this.getAnimationAndConfig();
|
86 | const delay = this.getDelay();
|
87 | const callback = this.callbackV;
|
88 | const initialValues = this.initialValues;
|
89 |
|
90 | return (values) => {
|
91 | 'worklet';
|
92 | return {
|
93 | animations: {
|
94 | opacity: delayFunction(delay, animation(1, config)),
|
95 | transform: [
|
96 | { rotate: delayFunction(delay, animation('0deg', config)) },
|
97 | { translateX: delayFunction(delay, animation(0, config)) },
|
98 | { translateY: delayFunction(delay, animation(0, config)) },
|
99 | ],
|
100 | },
|
101 | initialValues: {
|
102 | opacity: 0,
|
103 | transform: [
|
104 | { rotate: '90deg' },
|
105 | { translateX: -(values.targetWidth / 2 - values.targetHeight / 2) },
|
106 | { translateY: -(values.targetWidth / 2 - values.targetHeight / 2) },
|
107 | ],
|
108 | ...initialValues,
|
109 | },
|
110 | callback,
|
111 | };
|
112 | };
|
113 | };
|
114 | }
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 | export class RotateInUpLeft
|
124 | extends ComplexAnimationBuilder
|
125 | implements IEntryAnimationBuilder
|
126 | {
|
127 | static presetName = 'RotateInUpLeft';
|
128 |
|
129 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
130 | this: T
|
131 | ): InstanceType<T> {
|
132 | return new RotateInUpLeft() as InstanceType<T>;
|
133 | }
|
134 |
|
135 | build = (): AnimationConfigFunction<EntryAnimationsValues> => {
|
136 | const delayFunction = this.getDelayFunction();
|
137 | const [animation, config] = this.getAnimationAndConfig();
|
138 | const delay = this.getDelay();
|
139 | const callback = this.callbackV;
|
140 | const initialValues = this.initialValues;
|
141 |
|
142 | return (values) => {
|
143 | 'worklet';
|
144 | return {
|
145 | animations: {
|
146 | opacity: delayFunction(delay, animation(1, config)),
|
147 | transform: [
|
148 | { rotate: delayFunction(delay, animation('0deg', config)) },
|
149 | { translateX: delayFunction(delay, animation(0, config)) },
|
150 | { translateY: delayFunction(delay, animation(0, config)) },
|
151 | ],
|
152 | },
|
153 | initialValues: {
|
154 | opacity: 0,
|
155 | transform: [
|
156 | { rotate: '90deg' },
|
157 | { translateX: values.targetWidth / 2 - values.targetHeight / 2 },
|
158 | { translateY: values.targetWidth / 2 - values.targetHeight / 2 },
|
159 | ],
|
160 | ...initialValues,
|
161 | },
|
162 | callback,
|
163 | };
|
164 | };
|
165 | };
|
166 | }
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 | export class RotateInUpRight
|
176 | extends ComplexAnimationBuilder
|
177 | implements IEntryAnimationBuilder
|
178 | {
|
179 | static presetName = 'RotateInUpRight';
|
180 |
|
181 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
182 | this: T
|
183 | ): InstanceType<T> {
|
184 | return new RotateInUpRight() as InstanceType<T>;
|
185 | }
|
186 |
|
187 | build = (): AnimationConfigFunction<EntryAnimationsValues> => {
|
188 | const delayFunction = this.getDelayFunction();
|
189 | const [animation, config] = this.getAnimationAndConfig();
|
190 | const delay = this.getDelay();
|
191 | const callback = this.callbackV;
|
192 | const initialValues = this.initialValues;
|
193 |
|
194 | return (values) => {
|
195 | 'worklet';
|
196 | return {
|
197 | animations: {
|
198 | opacity: delayFunction(delay, animation(1, config)),
|
199 | transform: [
|
200 | { rotate: delayFunction(delay, animation('0deg', config)) },
|
201 | { translateX: delayFunction(delay, animation(0, config)) },
|
202 | { translateY: delayFunction(delay, animation(0, config)) },
|
203 | ],
|
204 | },
|
205 | initialValues: {
|
206 | opacity: 0,
|
207 | transform: [
|
208 | { rotate: '-90deg' },
|
209 | { translateX: -(values.targetWidth / 2 - values.targetHeight / 2) },
|
210 | { translateY: values.targetWidth / 2 - values.targetHeight / 2 },
|
211 | ],
|
212 | ...initialValues,
|
213 | },
|
214 | callback,
|
215 | };
|
216 | };
|
217 | };
|
218 | }
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 | export class RotateOutDownLeft
|
228 | extends ComplexAnimationBuilder
|
229 | implements IExitAnimationBuilder
|
230 | {
|
231 | static presetName = 'RotateOutDownLeft';
|
232 |
|
233 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
234 | this: T
|
235 | ): InstanceType<T> {
|
236 | return new RotateOutDownLeft() as InstanceType<T>;
|
237 | }
|
238 |
|
239 | build = (): AnimationConfigFunction<ExitAnimationsValues> => {
|
240 | const delayFunction = this.getDelayFunction();
|
241 | const [animation, config] = this.getAnimationAndConfig();
|
242 | const delay = this.getDelay();
|
243 | const callback = this.callbackV;
|
244 | const initialValues = this.initialValues;
|
245 |
|
246 | return (values) => {
|
247 | 'worklet';
|
248 | return {
|
249 | animations: {
|
250 | opacity: delayFunction(delay, animation(0, config)),
|
251 | transform: [
|
252 | { rotate: delayFunction(delay, animation('90deg', config)) },
|
253 | {
|
254 | translateX: delayFunction(
|
255 | delay,
|
256 | animation(
|
257 | values.currentWidth / 2 - values.currentHeight / 2,
|
258 | config
|
259 | )
|
260 | ),
|
261 | },
|
262 | {
|
263 | translateY: delayFunction(
|
264 | delay,
|
265 | animation(
|
266 | values.currentWidth / 2 - values.currentHeight / 2,
|
267 | config
|
268 | )
|
269 | ),
|
270 | },
|
271 | ],
|
272 | },
|
273 | initialValues: {
|
274 | opacity: 1,
|
275 | transform: [{ rotate: '0deg' }, { translateX: 0 }, { translateY: 0 }],
|
276 | ...initialValues,
|
277 | },
|
278 | callback,
|
279 | };
|
280 | };
|
281 | };
|
282 | }
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 | export class RotateOutDownRight
|
292 | extends ComplexAnimationBuilder
|
293 | implements IExitAnimationBuilder
|
294 | {
|
295 | static presetName = 'RotateOutDownRight';
|
296 |
|
297 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
298 | this: T
|
299 | ): InstanceType<T> {
|
300 | return new RotateOutDownRight() as InstanceType<T>;
|
301 | }
|
302 |
|
303 | build = (): AnimationConfigFunction<ExitAnimationsValues> => {
|
304 | const delayFunction = this.getDelayFunction();
|
305 | const [animation, config] = this.getAnimationAndConfig();
|
306 | const delay = this.getDelay();
|
307 | const callback = this.callbackV;
|
308 | const initialValues = this.initialValues;
|
309 |
|
310 | return (values) => {
|
311 | 'worklet';
|
312 | return {
|
313 | animations: {
|
314 | opacity: delayFunction(delay, animation(0, config)),
|
315 | transform: [
|
316 | { rotate: delayFunction(delay, animation('-90deg', config)) },
|
317 | {
|
318 | translateX: delayFunction(
|
319 | delay,
|
320 | animation(
|
321 | -(values.currentWidth / 2 - values.currentHeight / 2),
|
322 | config
|
323 | )
|
324 | ),
|
325 | },
|
326 | {
|
327 | translateY: delayFunction(
|
328 | delay,
|
329 | animation(
|
330 | values.currentWidth / 2 - values.currentHeight / 2,
|
331 | config
|
332 | )
|
333 | ),
|
334 | },
|
335 | ],
|
336 | },
|
337 | initialValues: {
|
338 | opacity: 1,
|
339 | transform: [{ rotate: '0deg' }, { translateX: 0 }, { translateY: 0 }],
|
340 | ...initialValues,
|
341 | },
|
342 | callback,
|
343 | };
|
344 | };
|
345 | };
|
346 | }
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 | export class RotateOutUpLeft
|
356 | extends ComplexAnimationBuilder
|
357 | implements IExitAnimationBuilder
|
358 | {
|
359 | static presetName = 'RotateOutUpLeft';
|
360 |
|
361 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
362 | this: T
|
363 | ): InstanceType<T> {
|
364 | return new RotateOutUpLeft() as InstanceType<T>;
|
365 | }
|
366 |
|
367 | build = (): AnimationConfigFunction<ExitAnimationsValues> => {
|
368 | const delayFunction = this.getDelayFunction();
|
369 | const [animation, config] = this.getAnimationAndConfig();
|
370 | const delay = this.getDelay();
|
371 | const callback = this.callbackV;
|
372 | const initialValues = this.initialValues;
|
373 |
|
374 | return (values) => {
|
375 | 'worklet';
|
376 | return {
|
377 | animations: {
|
378 | opacity: delayFunction(delay, animation(0, config)),
|
379 | transform: [
|
380 | { rotate: delayFunction(delay, animation('-90deg', config)) },
|
381 | {
|
382 | translateX: delayFunction(
|
383 | delay,
|
384 | animation(
|
385 | values.currentWidth / 2 - values.currentHeight / 2,
|
386 | config
|
387 | )
|
388 | ),
|
389 | },
|
390 | {
|
391 | translateY: delayFunction(
|
392 | delay,
|
393 | animation(
|
394 | -(values.currentWidth / 2 - values.currentHeight / 2),
|
395 | config
|
396 | )
|
397 | ),
|
398 | },
|
399 | ],
|
400 | },
|
401 | initialValues: {
|
402 | opacity: 1,
|
403 | transform: [{ rotate: '0deg' }, { translateX: 0 }, { translateY: 0 }],
|
404 | ...initialValues,
|
405 | },
|
406 | callback,
|
407 | };
|
408 | };
|
409 | };
|
410 | }
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 | export class RotateOutUpRight
|
420 | extends ComplexAnimationBuilder
|
421 | implements IExitAnimationBuilder
|
422 | {
|
423 | static presetName = 'RotateOutUpRight';
|
424 |
|
425 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
426 | this: T
|
427 | ): InstanceType<T> {
|
428 | return new RotateOutUpRight() as InstanceType<T>;
|
429 | }
|
430 |
|
431 | build = (): AnimationConfigFunction<ExitAnimationsValues> => {
|
432 | const delayFunction = this.getDelayFunction();
|
433 | const [animation, config] = this.getAnimationAndConfig();
|
434 | const delay = this.getDelay();
|
435 | const callback = this.callbackV;
|
436 | const initialValues = this.initialValues;
|
437 |
|
438 | return (values) => {
|
439 | 'worklet';
|
440 | return {
|
441 | animations: {
|
442 | opacity: delayFunction(delay, animation(0, config)),
|
443 | transform: [
|
444 | { rotate: delayFunction(delay, animation('90deg', config)) },
|
445 | {
|
446 | translateX: delayFunction(
|
447 | delay,
|
448 | animation(
|
449 | -(values.currentWidth / 2 - values.currentHeight / 2),
|
450 | config
|
451 | )
|
452 | ),
|
453 | },
|
454 | {
|
455 | translateY: delayFunction(
|
456 | delay,
|
457 | animation(
|
458 | -(values.currentWidth / 2 - values.currentHeight / 2),
|
459 | config
|
460 | )
|
461 | ),
|
462 | },
|
463 | ],
|
464 | },
|
465 | initialValues: {
|
466 | opacity: 1,
|
467 | transform: [{ rotate: '0deg' }, { translateX: 0 }, { translateY: 0 }],
|
468 | ...initialValues,
|
469 | },
|
470 | callback,
|
471 | };
|
472 | };
|
473 | };
|
474 | }
|