I am calling many requestAnimationFrames at the same time. How would I cancel all of the requestAnimationFrames such that none are running anymore?
You can call requestAnimationFrame, store the returned id, and then call cancelAnimationFrame for all positive integers less than that number.
function cancelAllAnimationFrames(){
var id = window.requestAnimationFrame(function(){});
while(id--){
window.cancelAnimationFrame(id);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With