Two of them work one after the other, but they take the height of the previous gsap, they do not work independently of each other.
// 1
let sections = gsap.utils.toArray(".comment-item");
gsap.to(sections, {
xPercent: -100 * (sections.length - 3),
ease: "none",
scrollTrigger: {
trigger: "#panels-container",
pin: true,
scrub: 1,
snap: 1 / (sections.length - 2),
end: "+=3500",
}
});
// 2
let changedFace = gsap.utils.toArray(".changed-face");
let currentFace = changedFace[0];
gsap.to(changedFace, {
ease: "powerIn",
scrollTrigger: {
trigger: ".local-seo",
pin: true,
scrub: 1,
opacity: 0,
duration:1,
snap: 1 / (changedFace.length - 1),
end: "+=500",
onUpdate: self => {
currentFace.classList.add("d-none");
currentFace = changedFace[Math.round(self.progress * (changedFace.length - 1))];
currentFace.classList.remove("d-none");
}
}
});