Calculate diff
Hellooo, here is my question, im like intermediate using js with frameworks, especially react even thought is a library and was making my portfolio web site, and was making the one from a youtube video. So the guy do this inside the useEffet function on react: window.addEventListener('scroll',()=>{ let scrollPosition=window.pageYOffset; let windowSize=window.innerHeight; let bodyHeight=document.body.offsetHeight; let diff= Math.max(bodyHeight- (scrollPosition + windowSize)); let diffP=(diff*100) / (bodyHeight- windowSize); ref.current.style.transform=`translateY(${-diffP}%)`; }) For a scroll effect, lot to explain hahaha, i know those functions and what they do but dont understand the math equations. I mean, what is the diff and diffP? The tutorial is a speedrun so he doesnt explain it.