Hi
I have an animation set to run on ScrollTriger but I would like it to run when page loaded as well.
It works in strict mode in react but not in production or when strict mode is disabled.
I would like to start animation after the page has loaded and on set ScrollTrigger.
How can I do that?
Thank you !
useLayoutEffect(() => {
const tl: gsap.core.Timeline = gsap.timeline({
scrollTrigger: {
trigger: props.navbar,
start: "center top",
toggleActions: "reverse none none play",
},
});
let ctx: gsap.Context = gsap.context(() => {
tl.to(props.navLink, {
x: "0",
autoAlpha: 1,
duration: 1,
stagger: 0.2,
delay: 0.2,
});
}, props.navbar);
tl.play()
return () => ctx.revert();
}, []);