Paul Irish has a post called requestAnimationFrame for Smart Animating. Now Paul is a smart guy - and I'm just trying to understand the scope of the application of this idea.
He says to do HTML5 animation - you should use a requestAnimationFrame shim like this:
// shim layer with setTimeout fallback
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
};
})();
// usage:
// instead of setInterval(render, 16) ....
(function animloop(){
requestAnimFrame(animloop);
render();
})();
// place the rAF *before* the render() to assure as close to
// 60fps with the setTimeout fallback.
Which is understandable. We can apply this in a JSFiddle like this and the results are quite good.
But if I rip out the shim layer function, then in Chrome 31 and Firefox 24 it works fine.
So if I look at the compatibility for the RequestAnimationFrame function - it looks like browsers have had this function for a very long time.
My question is - For which browsers are we using Paul Irish's requestAnimationFrame shim? You can rip it out and it still works, and it looks like browsers have had it for a long time.