Does cancelAnimationFrame
completely removes all the queued up animation logic?
For example, lets say the logic was complicated and my screen was doing 60FPS. the time it took to complete the entire logic per frame, lets say is 50ms. That is much more than 16.66667ms which is the minimum to maintain 60FPS.
If each frame takes 50ms in a total of 60 frames, there would be a build up of the animation logic queue. right?
Normally, at 60fps, with 60 frames, the entire animation should take 1 second. Right?
But with my animation logic, it will take 3 seconds total to complete the animation.
Let's assume, after I start the animation at t0, and I wait until t1.5 while animation is ongoing, and I run the cancelAnimationFrame
function, will it stop the animation right then and there? Or will it complete the entire animation until 3 seconds have passed?
What about if I run the cancelAnimationFrame
function at t0.5? will it stop the animation right then and there? Or will it complete halfway of the animation until 1.5 seconds have passed?
follow up edit for people reading this in the future:
yes. cancelAnimationFrame
does indeed stop the animation immediately as it is called. Yes to both of the above hypothetical questions.