pbojinov
11/17/2014 - 10:11 PM

requestAnimationFrame Shim

requestAnimationFrame Shim

/**
 * Paul Irish on RequestAnimFrame
 * 
 * http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
 */
// shim layer with setTimeout fallback
window.requestAnimFrame = (function(){
    return  window.requestAnimationFrame       ||
            window.webkitRequestAnimationFrame ||
            window.mozRequestAnimationFrame    ||
            function (callback){
                window.setTimeout(callback, 1000 / 60);
            };
})();