Hi there, hope you can help.
Im using GSAP3 latest version.
For some reason the stagger property gets ignored when used in the js interesection observer api. Works fine on its own.
// on its own, stagger works fine
gsap.fromTo(".card", { x: '100%' } , { stagger: 0.5, x: 0, duration: 2, ease: "power2.out" });
// not when called with js observer
const options = {
rootMargin: "0px",
threshold: 0
};
const moveup = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.intersectionRatio > 0) {
console.log(entry.ta);
// the fromTo gets fired but not the stagger
gsap.fromTo(entry.target, { x: '100%' } , { stagger: 0.5, x: 0, duration: 2, ease: "power2.out" });
moveup.unobserve(entry.target);
}
});
}, options);
const targetElements = document.querySelectorAll(".card");
for (let element of targetElements) {
moveup.observe(element);
}
thanks in advance.