let animateFrame ;
function animate (){
if(animateFrame > 200 ) {
window.cancelAnimationFrame(animateFrame );
}
console.log(animateFrame ) ;
animateFrame = window.requestAnimationFrame(animate);
}
animate()
let animateFrame ;
function animate (){
animateFrame = window.requestAnimationFrame(animate);
if(animateFrame > 200 ) {
window.cancelAnimationFrame(animateFrame );
}
console.log(animateFrame ) ;
}
animate()
It would be great if you explain it through example please .
Thank you for u r time.
In the first example: