Hello!
Long story short, I'm having difficulty getting a complicated animation work directly with snapTo: labelsDirectional. I don't want the animation to scrub, but I want it to play to certain labels in the animation based on the snap point. I understand how to do this, but cannot figure out how to return the index of a current snap before it finishes.
I have my snaps working using an object.
let snaps = [];
panels.forEach((panel, i) => {
snaps.push(i / panels.length);
});
console.log(snaps);
ScrollTrigger.create({
trigger: hero,
pin: hero,
start: "top top",
end: "+=" + (panels.length * 1000),
markers: true,
snap: {
snapTo: snaps,
duration: {min: 1.5, max: 2.5},
ease: "power2.inOut",
onStart: (e, i) => {
console.log(e);
}
}
});
The docs don't seem to include any properties inside of the onStart function. Is it possible to return the destination snap inside onStart? Even just the decimal value would work, as I can filter the array and find the correct index. I would then use this to animate the timeline to that corresponding label.
Thanks in advance for any nudge in the right direction!