Reputation: 481
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.
Upvotes: 0
Views: 699
Reputation: 943185
In the first example:
Upvotes: 2