use window.pageYOffset instead of window.scrollY and store windowHeight and document height instead of calling for it in each animationFrame