I have a useEffect hook which does some animations which goes like this -
useEffect(() => {
const ctx = gsap.context(() => {
const tl = gsap.timeline();
tl.from(".hero-text", {
opacity: 0,
x: "-5vmin",
delay: 1,
duration: 1,
ease: "expo.out",
stagger: 1,
});
tl.to(
".hero-text",
{
letterSpacing: "0.1em",
stagger: 0.9,
},
"-=2.5"
);
});
return ()