[5d6f37a] | 1 | import { VariantsType } from '../types';
|
---|
| 2 | //
|
---|
| 3 | import { varTranEnter, varTranExit } from './transition';
|
---|
| 4 |
|
---|
| 5 | // ----------------------------------------------------------------------
|
---|
| 6 |
|
---|
| 7 | export const varZoom = (props?: VariantsType) => {
|
---|
| 8 | const distance = props?.distance || 720;
|
---|
| 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: { scale: 0, opacity: 0 },
|
---|
| 18 | animate: {
|
---|
| 19 | scale: 1,
|
---|
| 20 | opacity: 1,
|
---|
| 21 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
| 22 | },
|
---|
| 23 | exit: {
|
---|
| 24 | scale: 0,
|
---|
| 25 | opacity: 0,
|
---|
| 26 | transition: varTranExit({ durationOut, easeOut }),
|
---|
| 27 | },
|
---|
| 28 | },
|
---|
| 29 | inUp: {
|
---|
| 30 | initial: { scale: 0, opacity: 0, translateY: distance },
|
---|
| 31 | animate: {
|
---|
| 32 | scale: 1,
|
---|
| 33 | opacity: 1,
|
---|
| 34 | translateY: 0,
|
---|
| 35 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
| 36 | },
|
---|
| 37 | exit: {
|
---|
| 38 | scale: 0,
|
---|
| 39 | opacity: 0,
|
---|
| 40 | translateY: distance,
|
---|
| 41 | transition: varTranExit({ durationOut, easeOut }),
|
---|
| 42 | },
|
---|
| 43 | },
|
---|
| 44 | inDown: {
|
---|
| 45 | initial: { scale: 0, opacity: 0, translateY: -distance },
|
---|
| 46 | animate: {
|
---|
| 47 | scale: 1,
|
---|
| 48 | opacity: 1,
|
---|
| 49 | translateY: 0,
|
---|
| 50 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
| 51 | },
|
---|
| 52 | exit: {
|
---|
| 53 | scale: 0,
|
---|
| 54 | opacity: 0,
|
---|
| 55 | translateY: -distance,
|
---|
| 56 | transition: varTranExit({ durationOut, easeOut }),
|
---|
| 57 | },
|
---|
| 58 | },
|
---|
| 59 | inLeft: {
|
---|
| 60 | initial: { scale: 0, opacity: 0, translateX: -distance },
|
---|
| 61 | animate: {
|
---|
| 62 | scale: 1,
|
---|
| 63 | opacity: 1,
|
---|
| 64 | translateX: 0,
|
---|
| 65 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
| 66 | },
|
---|
| 67 | exit: {
|
---|
| 68 | scale: 0,
|
---|
| 69 | opacity: 0,
|
---|
| 70 | translateX: -distance,
|
---|
| 71 | transition: varTranExit({ durationOut, easeOut }),
|
---|
| 72 | },
|
---|
| 73 | },
|
---|
| 74 | inRight: {
|
---|
| 75 | initial: { scale: 0, opacity: 0, translateX: distance },
|
---|
| 76 | animate: {
|
---|
| 77 | scale: 1,
|
---|
| 78 | opacity: 1,
|
---|
| 79 | translateX: 0,
|
---|
| 80 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
| 81 | },
|
---|
| 82 | exit: {
|
---|
| 83 | scale: 0,
|
---|
| 84 | opacity: 0,
|
---|
| 85 | translateX: distance,
|
---|
| 86 | transition: varTranExit({ durationOut, easeOut }),
|
---|
| 87 | },
|
---|
| 88 | },
|
---|
| 89 |
|
---|
| 90 | // OUT
|
---|
| 91 | out: {
|
---|
| 92 | initial: { scale: 1, opacity: 1 },
|
---|
| 93 | animate: {
|
---|
| 94 | scale: 0,
|
---|
| 95 | opacity: 0,
|
---|
| 96 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
| 97 | },
|
---|
| 98 | },
|
---|
| 99 | outUp: {
|
---|
| 100 | initial: { scale: 1, opacity: 1 },
|
---|
| 101 | animate: {
|
---|
| 102 | scale: 0,
|
---|
| 103 | opacity: 0,
|
---|
| 104 | translateY: -distance,
|
---|
| 105 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
| 106 | },
|
---|
| 107 | },
|
---|
| 108 | outDown: {
|
---|
| 109 | initial: { scale: 1, opacity: 1 },
|
---|
| 110 | animate: {
|
---|
| 111 | scale: 0,
|
---|
| 112 | opacity: 0,
|
---|
| 113 | translateY: distance,
|
---|
| 114 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
| 115 | },
|
---|
| 116 | },
|
---|
| 117 | outLeft: {
|
---|
| 118 | initial: { scale: 1, opacity: 1 },
|
---|
| 119 | animate: {
|
---|
| 120 | scale: 0,
|
---|
| 121 | opacity: 0,
|
---|
| 122 | translateX: -distance,
|
---|
| 123 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
| 124 | },
|
---|
| 125 | },
|
---|
| 126 | outRight: {
|
---|
| 127 | initial: { scale: 1, opacity: 1 },
|
---|
| 128 | animate: {
|
---|
| 129 | scale: 0,
|
---|
| 130 | opacity: 0,
|
---|
| 131 | translateX: distance,
|
---|
| 132 | transition: varTranEnter({ durationIn, easeIn }),
|
---|
| 133 | },
|
---|
| 134 | },
|
---|
| 135 | };
|
---|
| 136 | };
|
---|