Skip to content

Instantly share code, notes, and snippets.

@rktaiwala
rktaiwala / animationPolyfill.js
Created December 4, 2015 11:55 — forked from nielsdoorn/animationPolyfill.js
Eyes that follow your mouse cursor. Using HTML5 canvas.
// Paul Irish animation loop polyfill
// https://gist.github.com/paulirish/1579671
(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.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];