Sha256: 9b209ae38e225091d80c3b2dfffefdcf7f8af36da6947a8ec8d16e2b0c22c0bf
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
/** @scope window Polyfill for cross-browser backwards compatible window.requestAnimationFrame support. Modified from Erik Möller: http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating */ (function() { var lastTime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; window.cancelRequestAnimationFrame = window[vendors[x]+ 'CancelRequestAnimationFrame']; } if (!window.requestAnimationFrame) { window.requestAnimationFrame = function(callback) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function() { callback(window.performance.now()); }, timeToCall); lastTime = currTime + timeToCall; return id; }; } if (!window.cancelAnimationFrame) { window.cancelAnimationFrame = function(id) { clearTimeout(id); }; } }());
Version data entries
3 entries across 3 versions & 1 rubygems