1 | // types
|
---|
2 | import { VariantsType } from '../types';
|
---|
3 | //
|
---|
4 | import { varTranEnter, varTranExit } from './transition';
|
---|
5 |
|
---|
6 | // ----------------------------------------------------------------------
|
---|
7 |
|
---|
8 | export const varBounce = (props?: VariantsType) => {
|
---|
9 | const durationIn = props?.durationIn;
|
---|
10 | const durationOut = props?.durationOut;
|
---|
11 | const easeIn = props?.easeIn;
|
---|
12 | const easeOut = props?.easeOut;
|
---|
13 |
|
---|
14 | return {
|
---|
15 | // IN
|
---|
16 | in: {
|
---|
17 | initial: {},
|
---|
18 | animate: {
|
---|
19 | scale: [0.3, 1.1, 0.9, 1.03, 0.97, 1],
|
---|
20 | opacity: [0, 1, 1, 1, 1, 1],
|
---|
21 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
22 | },
|
---|
23 | exit: {
|
---|
24 | scale: [0.9, 1.1, 0.3],
|
---|
25 | opacity: [1, 1, 0],
|
---|
26 | },
|
---|
27 | },
|
---|
28 | inUp: {
|
---|
29 | initial: {},
|
---|
30 | animate: {
|
---|
31 | y: [720, -24, 12, -4, 0],
|
---|
32 | scaleY: [4, 0.9, 0.95, 0.985, 1],
|
---|
33 | opacity: [0, 1, 1, 1, 1],
|
---|
34 | transition: { ...varTranEnter({ durationIn, easeIn }) },
|
---|
35 | },
|
---|
36 | exit: {
|
---|
37 | y: [12, -24, 720],
|
---|
38 | scaleY: [0.985, 0.9, 3],
|
---|
39 | opacity: [1, 1, 0],
|
---|
40 | transition: varTranExit({ durationOut, easeOut }),
|
---|
41 | },
|
---|
42 | },
|
---|
43 | inDown: {
|
---|
44 | initial: {},
|
---|
45 | animate: {
|
---|
46 | y: [-720, 24, -12, 4, 0],
|
---|
47 | scaleY: [4, 0.9, 0.95, 0.985, 1],
|
---|
48 | opacity: [0, 1, 1, 1, 1],
|
---|
49 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
50 | },
|
---|
51 | exit: {
|
---|
52 | y: [-12, 24, -720],
|
---|
53 | scaleY: [0.985, 0.9, 3],
|
---|
54 | opacity: [1, 1, 0],
|
---|
55 | transition: varTranExit({ durationOut, easeOut }),
|
---|
56 | },
|
---|
57 | },
|
---|
58 | inLeft: {
|
---|
59 | initial: {},
|
---|
60 | animate: {
|
---|
61 | x: [-720, 24, -12, 4, 0],
|
---|
62 | scaleX: [3, 1, 0.98, 0.995, 1],
|
---|
63 | opacity: [0, 1, 1, 1, 1],
|
---|
64 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
65 | },
|
---|
66 | exit: {
|
---|
67 | x: [0, 24, -720],
|
---|
68 | scaleX: [1, 0.9, 2],
|
---|
69 | opacity: [1, 1, 0],
|
---|
70 | transition: varTranExit({ durationOut, easeOut }),
|
---|
71 | },
|
---|
72 | },
|
---|
73 | inRight: {
|
---|
74 | initial: {},
|
---|
75 | animate: {
|
---|
76 | x: [720, -24, 12, -4, 0],
|
---|
77 | scaleX: [3, 1, 0.98, 0.995, 1],
|
---|
78 | opacity: [0, 1, 1, 1, 1],
|
---|
79 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
80 | },
|
---|
81 | exit: {
|
---|
82 | x: [0, -24, 720],
|
---|
83 | scaleX: [1, 0.9, 2],
|
---|
84 | opacity: [1, 1, 0],
|
---|
85 | transition: varTranExit({ durationOut, easeOut }),
|
---|
86 | },
|
---|
87 | },
|
---|
88 |
|
---|
89 | // OUT
|
---|
90 | out: {
|
---|
91 | animate: { scale: [0.9, 1.1, 0.3], opacity: [1, 1, 0] },
|
---|
92 | },
|
---|
93 | outUp: {
|
---|
94 | animate: {
|
---|
95 | y: [-12, 24, -720],
|
---|
96 | scaleY: [0.985, 0.9, 3],
|
---|
97 | opacity: [1, 1, 0],
|
---|
98 | },
|
---|
99 | },
|
---|
100 | outDown: {
|
---|
101 | animate: {
|
---|
102 | y: [12, -24, 720],
|
---|
103 | scaleY: [0.985, 0.9, 3],
|
---|
104 | opacity: [1, 1, 0],
|
---|
105 | },
|
---|
106 | },
|
---|
107 | outLeft: {
|
---|
108 | animate: { x: [0, 24, -720], scaleX: [1, 0.9, 2], opacity: [1, 1, 0] },
|
---|
109 | },
|
---|
110 | outRight: {
|
---|
111 | animate: { x: [0, -24, 720], scaleX: [1, 0.9, 2], opacity: [1, 1, 0] },
|
---|
112 | },
|
---|
113 | };
|
---|
114 | };
|
---|