1 | 'use strict';
|
2 | import type { BaseAnimationBuilder } from '../animationBuilder';
|
3 | import { ComplexAnimationBuilder } from '../animationBuilder';
|
4 | import type {
|
5 | EntryExitAnimationFunction,
|
6 | IEntryExitAnimationBuilder,
|
7 | } from '../animationBuilder/commonTypes';
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export class PinwheelIn
|
17 | extends ComplexAnimationBuilder
|
18 | implements IEntryExitAnimationBuilder
|
19 | {
|
20 | static presetName = 'PinwheelIn';
|
21 |
|
22 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
23 | this: T
|
24 | ): InstanceType<T> {
|
25 | return new PinwheelIn() as InstanceType<T>;
|
26 | }
|
27 |
|
28 | build = (): EntryExitAnimationFunction => {
|
29 | const delayFunction = this.getDelayFunction();
|
30 | const [animation, config] = this.getAnimationAndConfig();
|
31 | const delay = this.getDelay();
|
32 | const callback = this.callbackV;
|
33 | const initialValues = this.initialValues;
|
34 |
|
35 | return () => {
|
36 | 'worklet';
|
37 | return {
|
38 | animations: {
|
39 | opacity: delayFunction(delay, animation(1, config)),
|
40 | transform: [
|
41 | {
|
42 | scale: delayFunction(delay, animation(1, config)),
|
43 | },
|
44 | {
|
45 | rotate: delayFunction(delay, animation('0', config)),
|
46 | },
|
47 | ],
|
48 | },
|
49 | initialValues: {
|
50 | opacity: 0,
|
51 | transform: [
|
52 | {
|
53 | scale: 0,
|
54 | },
|
55 | {
|
56 | rotate: '5',
|
57 | },
|
58 | ],
|
59 | ...initialValues,
|
60 | },
|
61 | callback,
|
62 | };
|
63 | };
|
64 | };
|
65 | }
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | export class PinwheelOut
|
75 | extends ComplexAnimationBuilder
|
76 | implements IEntryExitAnimationBuilder
|
77 | {
|
78 | static presetName = 'PinwheelOut';
|
79 |
|
80 | static createInstance<T extends typeof BaseAnimationBuilder>(
|
81 | this: T
|
82 | ): InstanceType<T> {
|
83 | return new PinwheelOut() as InstanceType<T>;
|
84 | }
|
85 |
|
86 | build = (): EntryExitAnimationFunction => {
|
87 | const delayFunction = this.getDelayFunction();
|
88 | const [animation, config] = this.getAnimationAndConfig();
|
89 | const delay = this.getDelay();
|
90 | const callback = this.callbackV;
|
91 | const initialValues = this.initialValues;
|
92 |
|
93 | return () => {
|
94 | 'worklet';
|
95 | return {
|
96 | animations: {
|
97 | opacity: delayFunction(delay, animation(0, config)),
|
98 | transform: [
|
99 | {
|
100 | scale: delayFunction(delay, animation(0, config)),
|
101 | },
|
102 | {
|
103 | rotate: delayFunction(delay, animation('5', config)),
|
104 | },
|
105 | ],
|
106 | },
|
107 | initialValues: {
|
108 | opacity: 1,
|
109 | transform: [
|
110 | {
|
111 | scale: 1,
|
112 | },
|
113 | {
|
114 | rotate: '0',
|
115 | },
|
116 | ],
|
117 | ...initialValues,
|
118 | },
|
119 | callback,
|
120 | };
|
121 | };
|
122 | };
|
123 | }
|