1 | import { VariantsType } from '../types';
|
---|
2 | import { varTranEnter, varTranExit } from './transition';
|
---|
3 |
|
---|
4 | // ----------------------------------------------------------------------
|
---|
5 |
|
---|
6 | export const varScale = (props?: VariantsType) => {
|
---|
7 | const durationIn = props?.durationIn;
|
---|
8 | const durationOut = props?.durationOut;
|
---|
9 | const easeIn = props?.easeIn;
|
---|
10 | const easeOut = props?.easeOut;
|
---|
11 |
|
---|
12 | return {
|
---|
13 | // IN
|
---|
14 | inX: {
|
---|
15 | initial: { scaleX: 0, opacity: 0 },
|
---|
16 | animate: {
|
---|
17 | scaleX: 1,
|
---|
18 | opacity: 1,
|
---|
19 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
20 | },
|
---|
21 | exit: {
|
---|
22 | scaleX: 0,
|
---|
23 | opacity: 0,
|
---|
24 | transition: varTranExit({ durationOut, easeOut }),
|
---|
25 | },
|
---|
26 | },
|
---|
27 | inY: {
|
---|
28 | initial: { scaleY: 0, opacity: 0 },
|
---|
29 | animate: {
|
---|
30 | scaleY: 1,
|
---|
31 | opacity: 1,
|
---|
32 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
33 | },
|
---|
34 | exit: {
|
---|
35 | scaleY: 0,
|
---|
36 | opacity: 0,
|
---|
37 | transition: varTranExit({ durationOut, easeOut }),
|
---|
38 | },
|
---|
39 | },
|
---|
40 |
|
---|
41 | // OUT
|
---|
42 | outX: {
|
---|
43 | initial: { scaleX: 1, opacity: 1 },
|
---|
44 | animate: {
|
---|
45 | scaleX: 0,
|
---|
46 | opacity: 0,
|
---|
47 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
48 | },
|
---|
49 | },
|
---|
50 | outY: {
|
---|
51 | initial: { scaleY: 1, opacity: 1 },
|
---|
52 | animate: {
|
---|
53 | scaleY: 0,
|
---|
54 | opacity: 0,
|
---|
55 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
56 | },
|
---|
57 | },
|
---|
58 | };
|
---|
59 | };
|
---|