Hello, everyone! I am using GSAP 3.8.0 with Next.js, and everything is working fine. However, when I upgraded to GSAP 3.12.0, my code stopped working as expected. Did something change from version 3.8.0 to 3.12.0? Here is my code:
function getScrollAmount() {
const extElements = document.querySelector("#extElements");
let racesWidth = extElements.scrollWidth;
return -(racesWidth - window.innerWidth);
}
useEffect(() => {
const extElements = document.querySelector("#extElements");
const tween = gsap.to(extElements, { x: getScrollAmount, duration: 3, ease: "none" });
ScrollTrigger.create({
trigger: ".extWrap",
start: "top 0%",
end: () => `+=${getScrollAmount() * -1}`,
pin: true,
animation: tween,
scrub: 1,
invalidateOnRefresh: true,
markers: false,
});
}, []);