const animation = gsap.to(node, {
x: width,
scrollTrigger: {
trigger: '#our_clients_section',
start: 'center bottom',
end: 'bottom top',
scrub: 3,
onUpdate: (self) => {
distanceTrainCrossed = parseInt(self.animation?._targets[0]._gsap.x)
}
}
})
I need the distanceTrainCrossed sync with train object latest position, but as there is scrub enabled of 3s. During the scrub, the onUpdate function not firing. so i can't get the latest position.