ScrollY animation on iphone incorrect after first bounce on bottom of page

I am using the window.scrollY event listener to get the scroll amount on my page and I set an animatino fram accordingly:

scroll = window.scrollY //inside the event listener


function animationLoop() { 


scrollRatio = scroll/window.innerHeight    
animMixer.setTime(scrollRatio) // every page is a "second"



This works wonderfully on the desktop, and also on iOS on the first scroll forward through the page. But as soon as the page bounces at the end, the scroll value seems to jump around unnecessarily, ie there is a mismatch between the position in the webpage and the animation frame. The timing is off until I scroll back to the very top of the page. After that the downward scrolling works fine again.

What happens to the scrollY value after bounce? I can’t figure out where the problem is. I’ve tried things like pageYOffset but the problem remains. Also, the value of the scrollRatio is clamped in the range [0, pageheightmax].

I know that there are some issues with the bouncy behavior of webpages on iOS, but these are negative values at the top of the page.

Thanks for any pointers.