michael@0: var rfa = null; michael@0: if (window.requestAnimationFrame) { michael@0: rfa = requestAnimationFrame; michael@0: } else if (window.mozRequestAnimationFrame) { michael@0: rfa = mozRequestAnimationFrame; michael@0: } else if (window.webkitRequestAnimationFrame) { michael@0: rfa = webkitRequestAnimationFrame; michael@0: } else if (window.msRequestAnimationFrame) { michael@0: rfa = msRequestAnimationFrame; michael@0: } else if (window.oRequestAnimationFrame) { michael@0: rfa = oRequestAnimationFrame; michael@0: } michael@0: michael@0: function animate(params, count) { michael@0: rfa(function() { michael@0: animateStep(params, count); michael@0: }); michael@0: } michael@0: michael@0: function animateStep(params, count) { michael@0: if (!count) { michael@0: document.documentElement.removeAttribute("class"); michael@0: return; michael@0: } michael@0: var rel = document.getElementById("rel"); michael@0: for (prop in params) { michael@0: rel.style[prop] = (parseInt(rel.style[prop]) + params[prop]) + "px"; michael@0: } michael@0: rfa(function() { michael@0: animateStep(params, count - 10); michael@0: }); michael@0: }