Closed sru closed 11 years ago
I heard that requestAnimationFrame is more optimized than setTimeout or setInterval. Should we use it?
Here is the cross-browser way:
window.requestAnimFrame = (function() { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(/* function FrameRequestCallback */ callback, /* DOMElement Element */ element) { window.setTimeout(callback, 1000/60); }; })()
And you can visit this site to control fps.
I heard that requestAnimationFrame is more optimized than setTimeout or setInterval. Should we use it?
Here is the cross-browser way:
And you can visit this site to control fps.