I have a working scroll component now, actually I am working in nextjs project, how can I make the scroll smooth, currently it just scrolls quickly and not at all smooth, also let me know if code quality can improved in this part.
useIsomorphicLayoutEffect(() => {
const ctx = gsap.context(() => {
const cards = gsap.utils.toArray(".item");
const timeline = gsap.timeline({
scrollTrigger: {
trigger: verticalSection.current,
pin: true,
start: "top top",
end: "+=100vh",
markers: true,
scrub: true,
},
});
timeline.from(cards, {
duration: 5,
y: () => window.innerHeight + 350,
ease: "none",
stagger: {
amount: 5,
ease: "none",
},
});
}, verticalSection);
return () => ctx.revert();
}, []);