I'm looking at the emerging standards for requestAnimationFrame
and cancelAnimationFrame
http://paulirish.com/2011/requestanimationframe-for-smart-animating/
and the various polyfills provided here:
The semantics of using these functions are slightly tricky to me. Specifically, suppose you requestAnimationFrame(callback)
once.
is it necessary to call cancelAnimationFrame
if you want to requestAnimationFrame(callback)
a second time before the first callback has been called? Will the browser call the callbacks repeatedly? Or will the browser automatically replace the doubled calls with a single one?
I'm asking because my current animation is really laggy on Firefox, and requestAnimationFrame doesn't seem to be helping too much. But I may be calling it too quickly from multiple sources. An authoritative answer on this would be great.