If you have spent any time developing with jQuery, you've most likely created some form of animation that included managing changes at a regular frequency—does this sound familiar?
We can, of course, use the
setInterval() function for this, but it—like the
setTimeOut() function—is not ideal. Both these functions have a delay before being initiated, which varies from browser to browser; they are both equally resource intensive!
Instead, we can use the requestAnimationFrame (rAF) API, which is now supported by most modern browsers, according to this chart from caniuse.com where green labels show which browser versions support requestAnimationFrame:
The great thing about the requestAnimationFrame API is that it is ...