indeed i did @Cassie
i've setState inside useLayoutEffect like so...
useLayoutEffect(() => {
let ctx = gsap.context(() => {
// all your animations go in here...
let tl = gsap.timeline({ duration: 2.5, delay: 1, repeat: 99 });
// tl.set("#logo", { opacity: 1 });
tl.set(".bg", { opacity: 2 }, 0);
tl.to(".triangle", { right: 0, duration: 0.6, ease: "power1.in" }, 0);
tl.to(".arrow-left", { right: 100, duration: 0.4, opacity: 1 }, 0.4);
tl.to(".arrow-right", { right: 30, duration: 0.4, opacity: 1 }, "<");
tl.to(".title-1", { xPercent: 100, duration: 0.6, ease: "power1.in" }, 0);
tl.to(".title-2", { opacity: 1, duration: 0.6, ease: "power1.in" }, 1);
// tl.to(".cta", { opacity: 1, ease: "power1.in" }, 1.8);
setTimeline(tl);
}, root); // <- scopes all selector text to the root element
setTimeline(ctx);
return () => ctx.revert();
}, []);
then passed the value={timeline} to my provider.
inside the child component i am either trying to access the (animation) timeline OR add to the timeline. in any case i end up with this (logged)
Context {data: Array(7), _r: Array(0), isReverted: false, id: 1, selector: ƒ, …}
data: (7) [Timeline, Tween, Tween, Tween, Tween, Tween, Tween]id: 1isReverted: falselast: ƒ f()selector: ƒ (v)_r: [][[Prototype]]: Object 'ctx'