MCPcopy Create free account
hub / github.com/api-platform/website / fadeOut

Function fadeOut

pwa/hooks/con/useAnimation.tsx:20–57  ·  view source on GitHub ↗
(
  element: gsap.TweenTarget,
  direction: DirectionType,
  duration: number,
  animationValue?: number
)

Source from the content-addressed store, hash-verified

18};
19
20const 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
59const useAnimation: (
60 direction?: DirectionType,

Callers 1

useAnimationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected