1 | 'use strict';
|
2 | import type {
|
3 | IEntryExitAnimationBuilder,
|
4 | EntryExitAnimationFunction,
|
5 | EntryAnimationsValues,
|
6 | ExitAnimationsValues,
|
7 | EntryExitAnimationsValues,
|
8 | AnimationConfigFunction,
|
9 | IEntryAnimationBuilder,
|
10 | IExitAnimationBuilder,
|
11 | } from '../animationBuilder/commonTypes';
|
12 | import type { BaseAnimationBuilder } from '../animationBuilder';
|
13 | import { ComplexAnimationBuilder } from '../animationBuilder';
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | export class ZoomIn
|
23 | extends ComplexAnimationBuilder
|
24 | implements IEntryExitAnimationBuilder
|
25 | {
|
26 | static presetName = 'ZoomIn';
|
27 |
|
28 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
29 | this: T
|
30 | ): InstanceType<T> {
|
31 | return new ZoomIn() as InstanceType<T>;
|
32 | }
|
33 |
|
34 | build = (): EntryExitAnimationFunction => {
|
35 | const delayFunction = this.getDelayFunction();
|
36 | const [animation, config] = this.getAnimationAndConfig();
|
37 | const delay = this.getDelay();
|
38 | const callback = this.callbackV;
|
39 | const initialValues = this.initialValues;
|
40 |
|
41 | return () => {
|
42 | 'worklet';
|
43 | return {
|
44 | animations: {
|
45 | transform: [{ scale: delayFunction(delay, animation(1, config)) }],
|
46 | },
|
47 | initialValues: {
|
48 | transform: [{ scale: 0 }],
|
49 | ...initialValues,
|
50 | },
|
51 | callback,
|
52 | };
|
53 | };
|
54 | };
|
55 | }
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 | export class ZoomInRotate
|
65 | extends ComplexAnimationBuilder
|
66 | implements IEntryExitAnimationBuilder
|
67 | {
|
68 | static presetName = 'ZoomInRotate';
|
69 |
|
70 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
71 | this: T
|
72 | ): InstanceType<T> {
|
73 | return new ZoomInRotate() as InstanceType<T>;
|
74 | }
|
75 |
|
76 | build = (): EntryExitAnimationFunction => {
|
77 | const delayFunction = this.getDelayFunction();
|
78 | const [animation, config] = this.getAnimationAndConfig();
|
79 | const delay = this.getDelay();
|
80 | const rotate = this.rotateV ? this.rotateV : '0.3';
|
81 | const callback = this.callbackV;
|
82 | const initialValues = this.initialValues;
|
83 |
|
84 | return () => {
|
85 | 'worklet';
|
86 | return {
|
87 | animations: {
|
88 | transform: [
|
89 | { scale: delayFunction(delay, animation(1, config)) },
|
90 | { rotate: delayFunction(delay, animation(0, config)) },
|
91 | ],
|
92 | },
|
93 | initialValues: {
|
94 | transform: [{ scale: 0 }, { rotate }],
|
95 | ...initialValues,
|
96 | },
|
97 | callback,
|
98 | };
|
99 | };
|
100 | };
|
101 | }
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 | export class ZoomInLeft
|
111 | extends ComplexAnimationBuilder
|
112 | implements IEntryExitAnimationBuilder
|
113 | {
|
114 | static presetName = 'ZoomInLeft';
|
115 |
|
116 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
117 | this: T
|
118 | ): InstanceType<T> {
|
119 | return new ZoomInLeft() as InstanceType<T>;
|
120 | }
|
121 |
|
122 | build = (): EntryExitAnimationFunction => {
|
123 | const delayFunction = this.getDelayFunction();
|
124 | const [animation, config] = this.getAnimationAndConfig();
|
125 | const delay = this.getDelay();
|
126 | const callback = this.callbackV;
|
127 | const initialValues = this.initialValues;
|
128 |
|
129 | return (values: EntryExitAnimationsValues) => {
|
130 | 'worklet';
|
131 | return {
|
132 | animations: {
|
133 | transform: [
|
134 | { translateX: delayFunction(delay, animation(0, config)) },
|
135 | { scale: delayFunction(delay, animation(1, config)) },
|
136 | ],
|
137 | },
|
138 | initialValues: {
|
139 | transform: [{ translateX: -values.windowWidth }, { scale: 0 }],
|
140 | ...initialValues,
|
141 | },
|
142 | callback,
|
143 | };
|
144 | };
|
145 | };
|
146 | }
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 | export class ZoomInRight
|
156 | extends ComplexAnimationBuilder
|
157 | implements IEntryExitAnimationBuilder
|
158 | {
|
159 | static presetName = 'ZoomInRight';
|
160 |
|
161 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
162 | this: T
|
163 | ): InstanceType<T> {
|
164 | return new ZoomInRight() as InstanceType<T>;
|
165 | }
|
166 |
|
167 | build = (): EntryExitAnimationFunction => {
|
168 | const delayFunction = this.getDelayFunction();
|
169 | const [animation, config] = this.getAnimationAndConfig();
|
170 | const delay = this.getDelay();
|
171 | const callback = this.callbackV;
|
172 | const initialValues = this.initialValues;
|
173 |
|
174 | return (values: EntryExitAnimationsValues) => {
|
175 | 'worklet';
|
176 | return {
|
177 | animations: {
|
178 | transform: [
|
179 | { translateX: delayFunction(delay, animation(0, config)) },
|
180 | { scale: delayFunction(delay, animation(1, config)) },
|
181 | ],
|
182 | },
|
183 | initialValues: {
|
184 | transform: [{ translateX: values.windowWidth }, { scale: 0 }],
|
185 | ...initialValues,
|
186 | },
|
187 | callback,
|
188 | };
|
189 | };
|
190 | };
|
191 | }
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | export class ZoomInUp
|
201 | extends ComplexAnimationBuilder
|
202 | implements IEntryExitAnimationBuilder
|
203 | {
|
204 | static presetName = 'ZoomInUp';
|
205 |
|
206 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
207 | this: T
|
208 | ): InstanceType<T> {
|
209 | return new ZoomInUp() as InstanceType<T>;
|
210 | }
|
211 |
|
212 | build = (): EntryExitAnimationFunction => {
|
213 | const delayFunction = this.getDelayFunction();
|
214 | const [animation, config] = this.getAnimationAndConfig();
|
215 | const delay = this.getDelay();
|
216 | const callback = this.callbackV;
|
217 | const initialValues = this.initialValues;
|
218 |
|
219 | return (values: EntryExitAnimationsValues) => {
|
220 | 'worklet';
|
221 | return {
|
222 | animations: {
|
223 | transform: [
|
224 | { translateY: delayFunction(delay, animation(0, config)) },
|
225 | { scale: delayFunction(delay, animation(1, config)) },
|
226 | ],
|
227 | },
|
228 | initialValues: {
|
229 | transform: [{ translateY: -values.windowHeight }, { scale: 0 }],
|
230 | ...initialValues,
|
231 | },
|
232 | callback,
|
233 | };
|
234 | };
|
235 | };
|
236 | }
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 | export class ZoomInDown
|
246 | extends ComplexAnimationBuilder
|
247 | implements IEntryExitAnimationBuilder
|
248 | {
|
249 | static presetName = 'ZoomInDown';
|
250 |
|
251 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
252 | this: T
|
253 | ): InstanceType<T> {
|
254 | return new ZoomInDown() as InstanceType<T>;
|
255 | }
|
256 |
|
257 | build = (): EntryExitAnimationFunction => {
|
258 | const delayFunction = this.getDelayFunction();
|
259 | const [animation, config] = this.getAnimationAndConfig();
|
260 | const delay = this.getDelay();
|
261 | const callback = this.callbackV;
|
262 | const initialValues = this.initialValues;
|
263 |
|
264 | return (values: EntryExitAnimationsValues) => {
|
265 | 'worklet';
|
266 | return {
|
267 | animations: {
|
268 | transform: [
|
269 | { translateY: delayFunction(delay, animation(0, config)) },
|
270 | { scale: delayFunction(delay, animation(1, config)) },
|
271 | ],
|
272 | },
|
273 | initialValues: {
|
274 | transform: [{ translateY: values.windowHeight }, { scale: 0 }],
|
275 | ...initialValues,
|
276 | },
|
277 | callback,
|
278 | };
|
279 | };
|
280 | };
|
281 | }
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 | export class ZoomInEasyUp
|
291 | extends ComplexAnimationBuilder
|
292 | implements IEntryAnimationBuilder
|
293 | {
|
294 | static presetName = 'ZoomInEasyUp';
|
295 |
|
296 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
297 | this: T
|
298 | ): InstanceType<T> {
|
299 | return new ZoomInEasyUp() as InstanceType<T>;
|
300 | }
|
301 |
|
302 | build = (): AnimationConfigFunction<EntryAnimationsValues> => {
|
303 | const delayFunction = this.getDelayFunction();
|
304 | const [animation, config] = this.getAnimationAndConfig();
|
305 | const delay = this.getDelay();
|
306 | const callback = this.callbackV;
|
307 | const initialValues = this.initialValues;
|
308 |
|
309 | return (values) => {
|
310 | 'worklet';
|
311 | return {
|
312 | animations: {
|
313 | transform: [
|
314 | { translateY: delayFunction(delay, animation(0, config)) },
|
315 | { scale: delayFunction(delay, animation(1, config)) },
|
316 | ],
|
317 | },
|
318 | initialValues: {
|
319 | transform: [{ translateY: -values.targetHeight }, { scale: 0 }],
|
320 | ...initialValues,
|
321 | },
|
322 | callback,
|
323 | };
|
324 | };
|
325 | };
|
326 | }
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 | export class ZoomInEasyDown
|
336 | extends ComplexAnimationBuilder
|
337 | implements IEntryAnimationBuilder
|
338 | {
|
339 | static presetName = 'ZoomInEasyDown';
|
340 |
|
341 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
342 | this: T
|
343 | ): InstanceType<T> {
|
344 | return new ZoomInEasyDown() as InstanceType<T>;
|
345 | }
|
346 |
|
347 | build = (): AnimationConfigFunction<EntryAnimationsValues> => {
|
348 | const delayFunction = this.getDelayFunction();
|
349 | const [animation, config] = this.getAnimationAndConfig();
|
350 | const delay = this.getDelay();
|
351 | const callback = this.callbackV;
|
352 | const initialValues = this.initialValues;
|
353 |
|
354 | return (values) => {
|
355 | 'worklet';
|
356 | return {
|
357 | animations: {
|
358 | transform: [
|
359 | { translateY: delayFunction(delay, animation(0, config)) },
|
360 | { scale: delayFunction(delay, animation(1, config)) },
|
361 | ],
|
362 | },
|
363 | initialValues: {
|
364 | transform: [{ translateY: values.targetHeight }, { scale: 0 }],
|
365 | ...initialValues,
|
366 | },
|
367 | callback,
|
368 | };
|
369 | };
|
370 | };
|
371 | }
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 | export class ZoomOut
|
381 | extends ComplexAnimationBuilder
|
382 | implements IEntryExitAnimationBuilder
|
383 | {
|
384 | static presetName = 'ZoomOut';
|
385 |
|
386 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
387 | this: T
|
388 | ): InstanceType<T> {
|
389 | return new ZoomOut() as InstanceType<T>;
|
390 | }
|
391 |
|
392 | build = (): EntryExitAnimationFunction => {
|
393 | const delayFunction = this.getDelayFunction();
|
394 | const [animation, config] = this.getAnimationAndConfig();
|
395 | const delay = this.getDelay();
|
396 | const callback = this.callbackV;
|
397 | const initialValues = this.initialValues;
|
398 |
|
399 | return () => {
|
400 | 'worklet';
|
401 | return {
|
402 | animations: {
|
403 | transform: [{ scale: delayFunction(delay, animation(0, config)) }],
|
404 | },
|
405 | initialValues: {
|
406 | transform: [{ scale: 1 }],
|
407 | ...initialValues,
|
408 | },
|
409 | callback,
|
410 | };
|
411 | };
|
412 | };
|
413 | }
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 | export class ZoomOutRotate
|
423 | extends ComplexAnimationBuilder
|
424 | implements IEntryExitAnimationBuilder
|
425 | {
|
426 | static presetName = 'ZoomOutRotate';
|
427 |
|
428 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
429 | this: T
|
430 | ): InstanceType<T> {
|
431 | return new ZoomOutRotate() as InstanceType<T>;
|
432 | }
|
433 |
|
434 | build = (): EntryExitAnimationFunction => {
|
435 | const delayFunction = this.getDelayFunction();
|
436 | const [animation, config] = this.getAnimationAndConfig();
|
437 | const delay = this.getDelay();
|
438 | const rotate = this.rotateV ? this.rotateV : '0.3';
|
439 | const callback = this.callbackV;
|
440 | const initialValues = this.initialValues;
|
441 |
|
442 | return () => {
|
443 | 'worklet';
|
444 | return {
|
445 | animations: {
|
446 | transform: [
|
447 | { scale: delayFunction(delay, animation(0, config)) },
|
448 | { rotate: delayFunction(delay, animation(rotate, config)) },
|
449 | ],
|
450 | },
|
451 | initialValues: {
|
452 | transform: [{ scale: 1 }, { rotate: '0' }],
|
453 | ...initialValues,
|
454 | },
|
455 | callback,
|
456 | };
|
457 | };
|
458 | };
|
459 | }
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 | export class ZoomOutLeft
|
469 | extends ComplexAnimationBuilder
|
470 | implements IEntryExitAnimationBuilder
|
471 | {
|
472 | static presetName = 'ZoomOutLeft';
|
473 |
|
474 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
475 | this: T
|
476 | ): InstanceType<T> {
|
477 | return new ZoomOutLeft() as InstanceType<T>;
|
478 | }
|
479 |
|
480 | build = (): EntryExitAnimationFunction => {
|
481 | const delayFunction = this.getDelayFunction();
|
482 | const [animation, config] = this.getAnimationAndConfig();
|
483 | const delay = this.getDelay();
|
484 | const callback = this.callbackV;
|
485 | const initialValues = this.initialValues;
|
486 |
|
487 | return (values: EntryExitAnimationsValues) => {
|
488 | 'worklet';
|
489 | return {
|
490 | animations: {
|
491 | transform: [
|
492 | {
|
493 | translateX: delayFunction(
|
494 | delay,
|
495 | animation(-values.windowWidth, config)
|
496 | ),
|
497 | },
|
498 | { scale: delayFunction(delay, animation(0, config)) },
|
499 | ],
|
500 | },
|
501 | initialValues: {
|
502 | transform: [{ translateX: 0 }, { scale: 1 }],
|
503 | ...initialValues,
|
504 | },
|
505 | callback,
|
506 | };
|
507 | };
|
508 | };
|
509 | }
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 | export class ZoomOutRight
|
519 | extends ComplexAnimationBuilder
|
520 | implements IEntryExitAnimationBuilder
|
521 | {
|
522 | static presetName = 'ZoomOutRight';
|
523 |
|
524 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
525 | this: T
|
526 | ): InstanceType<T> {
|
527 | return new ZoomOutRight() as InstanceType<T>;
|
528 | }
|
529 |
|
530 | build = (): EntryExitAnimationFunction => {
|
531 | const delayFunction = this.getDelayFunction();
|
532 | const [animation, config] = this.getAnimationAndConfig();
|
533 | const delay = this.getDelay();
|
534 | const callback = this.callbackV;
|
535 | const initialValues = this.initialValues;
|
536 |
|
537 | return (values: EntryExitAnimationsValues) => {
|
538 | 'worklet';
|
539 | return {
|
540 | animations: {
|
541 | transform: [
|
542 | {
|
543 | translateX: delayFunction(
|
544 | delay,
|
545 | animation(values.windowWidth, config)
|
546 | ),
|
547 | },
|
548 | { scale: delayFunction(delay, animation(0, config)) },
|
549 | ],
|
550 | },
|
551 | initialValues: {
|
552 | transform: [{ translateX: 0 }, { scale: 1 }],
|
553 | ...initialValues,
|
554 | },
|
555 | callback,
|
556 | };
|
557 | };
|
558 | };
|
559 | }
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 | export class ZoomOutUp
|
569 | extends ComplexAnimationBuilder
|
570 | implements IEntryExitAnimationBuilder
|
571 | {
|
572 | static presetName = 'ZoomOutUp';
|
573 |
|
574 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
575 | this: T
|
576 | ): InstanceType<T> {
|
577 | return new ZoomOutUp() as InstanceType<T>;
|
578 | }
|
579 |
|
580 | build = (): EntryExitAnimationFunction => {
|
581 | const delayFunction = this.getDelayFunction();
|
582 | const [animation, config] = this.getAnimationAndConfig();
|
583 | const delay = this.getDelay();
|
584 | const callback = this.callbackV;
|
585 | const initialValues = this.initialValues;
|
586 |
|
587 | return (values: EntryExitAnimationsValues) => {
|
588 | 'worklet';
|
589 | return {
|
590 | animations: {
|
591 | transform: [
|
592 | {
|
593 | translateY: delayFunction(
|
594 | delay,
|
595 | animation(-values.windowHeight, config)
|
596 | ),
|
597 | },
|
598 | { scale: delayFunction(delay, animation(0, config)) },
|
599 | ],
|
600 | },
|
601 | initialValues: {
|
602 | transform: [{ translateY: 0 }, { scale: 1 }],
|
603 | ...initialValues,
|
604 | },
|
605 | callback,
|
606 | };
|
607 | };
|
608 | };
|
609 | }
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 | export class ZoomOutDown
|
619 | extends ComplexAnimationBuilder
|
620 | implements IEntryExitAnimationBuilder
|
621 | {
|
622 | static presetName = 'ZoomOutDown';
|
623 |
|
624 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
625 | this: T
|
626 | ): InstanceType<T> {
|
627 | return new ZoomOutDown() as InstanceType<T>;
|
628 | }
|
629 |
|
630 | build = (): EntryExitAnimationFunction => {
|
631 | const delayFunction = this.getDelayFunction();
|
632 | const [animation, config] = this.getAnimationAndConfig();
|
633 | const delay = this.getDelay();
|
634 | const callback = this.callbackV;
|
635 | const initialValues = this.initialValues;
|
636 |
|
637 | return (values: EntryExitAnimationsValues) => {
|
638 | 'worklet';
|
639 | return {
|
640 | animations: {
|
641 | transform: [
|
642 | {
|
643 | translateY: delayFunction(
|
644 | delay,
|
645 | animation(values.windowHeight, config)
|
646 | ),
|
647 | },
|
648 | { scale: delayFunction(delay, animation(0, config)) },
|
649 | ],
|
650 | },
|
651 | initialValues: {
|
652 | transform: [{ translateY: 0 }, { scale: 1 }],
|
653 | ...initialValues,
|
654 | },
|
655 | callback,
|
656 | };
|
657 | };
|
658 | };
|
659 | }
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 | export class ZoomOutEasyUp
|
669 | extends ComplexAnimationBuilder
|
670 | implements IExitAnimationBuilder
|
671 | {
|
672 | static presetName = 'ZoomOutEasyUp';
|
673 |
|
674 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
675 | this: T
|
676 | ): InstanceType<T> {
|
677 | return new ZoomOutEasyUp() as InstanceType<T>;
|
678 | }
|
679 |
|
680 | build = (): AnimationConfigFunction<ExitAnimationsValues> => {
|
681 | const delayFunction = this.getDelayFunction();
|
682 | const [animation, config] = this.getAnimationAndConfig();
|
683 | const delay = this.getDelay();
|
684 | const callback = this.callbackV;
|
685 | const initialValues = this.initialValues;
|
686 |
|
687 | return (values) => {
|
688 | 'worklet';
|
689 | return {
|
690 | animations: {
|
691 | transform: [
|
692 | {
|
693 | translateY: delayFunction(
|
694 | delay,
|
695 | animation(-values.currentHeight, config)
|
696 | ),
|
697 | },
|
698 | { scale: delayFunction(delay, animation(0, config)) },
|
699 | ],
|
700 | },
|
701 | initialValues: {
|
702 | transform: [{ translateY: 0 }, { scale: 1 }],
|
703 | ...initialValues,
|
704 | },
|
705 | callback,
|
706 | };
|
707 | };
|
708 | };
|
709 | }
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 | export class ZoomOutEasyDown
|
719 | extends ComplexAnimationBuilder
|
720 | implements IExitAnimationBuilder
|
721 | {
|
722 | static presetName = 'ZoomOutEasyDown';
|
723 |
|
724 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
725 | this: T
|
726 | ): InstanceType<T> {
|
727 | return new ZoomOutEasyDown() as InstanceType<T>;
|
728 | }
|
729 |
|
730 | build = (): AnimationConfigFunction<ExitAnimationsValues> => {
|
731 | const delayFunction = this.getDelayFunction();
|
732 | const [animation, config] = this.getAnimationAndConfig();
|
733 | const delay = this.getDelay();
|
734 | const callback = this.callbackV;
|
735 | const initialValues = this.initialValues;
|
736 |
|
737 | return (values) => {
|
738 | 'worklet';
|
739 | return {
|
740 | animations: {
|
741 | transform: [
|
742 | {
|
743 | translateY: delayFunction(
|
744 | delay,
|
745 | animation(values.currentHeight, config)
|
746 | ),
|
747 | },
|
748 | { scale: delayFunction(delay, animation(0, config)) },
|
749 | ],
|
750 | },
|
751 | initialValues: {
|
752 | transform: [{ translateY: 0 }, { scale: 1 }],
|
753 | ...initialValues,
|
754 | },
|
755 | callback,
|
756 | };
|
757 | };
|
758 | };
|
759 | }
|