| 18 | }; |
| 19 | |
| 20 | const fadeOut = ( |
| 21 | element: gsap.TweenTarget, |
| 22 | direction: DirectionType, |
| 23 | duration: number, |
| 24 | animationValue?: number |
| 25 | ) => { |
| 26 | let x = 0; |
| 27 | let y = 0; |
| 28 | let scale = 1; |
| 29 | switch (direction) { |
| 30 | case "bottom": |
| 31 | y = animationValue || +100; |
| 32 | break; |
| 33 | case "left": |
| 34 | x = animationValue || +100; |
| 35 | break; |
| 36 | case "right": |
| 37 | x = animationValue || -100; |
| 38 | break; |
| 39 | case "scale": |
| 40 | scale = animationValue || 0.8; |
| 41 | break; |
| 42 | case "top": |
| 43 | y = animationValue || +100; |
| 44 | break; |
| 45 | default: |
| 46 | x = animationValue || +100; |
| 47 | } |
| 48 | |
| 49 | gsap.to(element, { |
| 50 | opacity: 0, |
| 51 | duration, |
| 52 | x, |
| 53 | y, |
| 54 | scale, |
| 55 | ease: "power4.out", |
| 56 | }); |
| 57 | }; |
| 58 | |
| 59 | const useAnimation: ( |
| 60 | direction?: DirectionType, |