Sha256: c56f25ede7c7945c2350425f4c7bfd2cfa784b15ffcb570e10c6e8f5c1335fb3
Contents?: true
Size: 1.04 KB
Versions: 10
Compression:
Stored size: 1.04 KB
Contents
/** @scope window Polyfill for cross-browser backwards compatible window.requestAnimationFrame support. Via 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, element) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function(id) { clearTimeout(id); }; }())
Version data entries
10 entries across 10 versions & 1 rubygems