I want to add a class to some elements on my website to use the same animation on when scrolling in viewport. Everything works fine but when there are multiple elements next to each other I want to add a stagger effect. For some reason this is not working.... This is the code I'm using:
const animateUp = gsap.utils.toArray('.animate-up');
animateUp.forEach(element => {
gsap.from(element, {
y: '50px',
stagger: .3,
opacity:0,
duration: .8,
scrollTrigger: {
trigger: element,
}
})
});