I'm hoping to get a GSAP animation to play ONCE when scrolling, but it seems if the user scrolls, let's say 20px on a long swipe on the touchpad or mouse wheel, it's playing 20 times. How can I limit this in the wheel
event in Javascript.
I've added some code below as an example:
let isAnimating = false;
window.addEventListener('wheel', (event) => {
if (!isAnimating) {
isAnimating = true;
slideTimelines[0].play(0).then(() => {
isAnimating = false;
});
}
});