I've seen various threads and blog posts about using lagSmoothing() to prevent animations pausing when switching screens. Every time I try to implement solutions, I get either ___ is not a function or not a method, or cannot read property ___ of undefined or something to that effect.
Here's the base animation:
useEffect(() => {
const timeline = new TimelineLite();
timeline.from(itemRef.current, {
autoAlpha: 0,
stagger: 0.5,
});
});
I've tried adding a TweenLite instance, like recommended here and elsewhere
useEffect(() => {
const timeline = new TimelineLite();
TweenLite.ticker.useRAF(false);
TweenLite.lagSmoothing(0);
timeline.from(itemRef.current, {
autoAlpha: 0,
stagger: 0.5,
});
});
I've also tried adding the fn directly to my timeline instance:
useEffect(() => {
const timeline = new TimelineLite();
timeline.lagSmoothing(0);
timeline.from(itemRef.current, {
autoAlpha: 0,
stagger: 0.5,
});
});
And have also tried with the updated gsap.timeline() syntax from this Stack OVerflow post.
Does anyone have an example of how lagsmoothing should be used with a timeline instance?