idea from: Google HTML5 Game Development Talk
Monkey Targets Forums/HTML5/idea from: Google HTML5 Game Development Talk
| ||
Google says: Do not use setInterval() and setTimeout() !!! Use requestAnimationFrame(callback,element) http://io-2011-html5-games-hr.appspot.com/#28 https://developer.mozilla.org/en/DOM/window.mozRequestAnimationFrame They use this script: ----------------------- window.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(/* function */ callback, /* DOMElement */ element){ window.setTimeout(callback, 1000 / 60); }; })(); ----------------------- I don't know if monkey uses this now but its maybe a good idea ? Greeting, GCMartijn |