Thanks for super fast response!
I just installed the package and tested it.
Now it works, but still have issues with certain toggleActions values
function Component({delay}){
const target = useRef()
useEffect(()=>{
gsap.registerPlugin(ScrollTrigger)
gsap.to(target.current, {opacity: 1, visibility: 'visible', y:0, duration: 1, delay: delay, scrollTrigger: {
trigger: target.current,
start: "top 90%",
toggleActions: "play none none none", // this works perfectly
//toggleActions: "restart none none none", // this doesn't delay animation
}})
},[])
return(
<ContainerAnimated ref={target}>
// ... other child components
</ContainerAnimated>
)
}
Would be greatful for any hint
*edited: delay value is comming from props and it is a number