1 | import { VariantsType } from '../types';
|
---|
2 | //
|
---|
3 | import { varTranEnter, varTranExit } from './transition';
|
---|
4 |
|
---|
5 | // ----------------------------------------------------------------------
|
---|
6 |
|
---|
7 | export const varSlide = (props?: VariantsType) => {
|
---|
8 | const distance = props?.distance || 160;
|
---|
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 | inUp: {
|
---|
17 | initial: { y: distance },
|
---|
18 | animate: { y: 0, transition: varTranEnter({ durationIn, easeIn }) },
|
---|
19 | exit: { y: distance, transition: varTranExit({ durationOut, easeOut }) },
|
---|
20 | },
|
---|
21 | inDown: {
|
---|
22 | initial: { y: -distance },
|
---|
23 | animate: { y: 0, transition: varTranEnter({ durationIn, easeIn }) },
|
---|
24 | exit: { y: -distance, transition: varTranExit({ durationOut, easeOut }) },
|
---|
25 | },
|
---|
26 | inLeft: {
|
---|
27 | initial: { x: -distance },
|
---|
28 | animate: { x: 0, transition: varTranEnter({ durationIn, easeIn }) },
|
---|
29 | exit: { x: -distance, transition: varTranExit({ durationOut, easeOut }) },
|
---|
30 | },
|
---|
31 | inRight: {
|
---|
32 | initial: { x: distance },
|
---|
33 | animate: { x: 0, transition: varTranEnter({ durationIn, easeIn }) },
|
---|
34 | exit: { x: distance, transition: varTranExit({ durationOut, easeOut }) },
|
---|
35 | },
|
---|
36 |
|
---|
37 | // OUT
|
---|
38 | outUp: {
|
---|
39 | initial: { y: 0 },
|
---|
40 | animate: {
|
---|
41 | y: -distance,
|
---|
42 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
43 | },
|
---|
44 | exit: { y: 0, transition: varTranExit({ durationOut, easeOut }) },
|
---|
45 | },
|
---|
46 | outDown: {
|
---|
47 | initial: { y: 0 },
|
---|
48 | animate: {
|
---|
49 | y: distance,
|
---|
50 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
51 | },
|
---|
52 | exit: { y: 0, transition: varTranExit({ durationOut, easeOut }) },
|
---|
53 | },
|
---|
54 | outLeft: {
|
---|
55 | initial: { x: 0 },
|
---|
56 | animate: {
|
---|
57 | x: -distance,
|
---|
58 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
59 | },
|
---|
60 | exit: { x: 0, transition: varTranExit({ durationOut, easeOut }) },
|
---|
61 | },
|
---|
62 | outRight: {
|
---|
63 | initial: { x: 0 },
|
---|
64 | animate: {
|
---|
65 | x: distance,
|
---|
66 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
67 | },
|
---|
68 | exit: { x: 0, transition: varTranExit({ durationOut, easeOut }) },
|
---|
69 | },
|
---|
70 | };
|
---|
71 | };
|
---|