im creating a HTML5 Canvas animations and wish to reduce / throttle the frame rate. I'm currently using the requestAnimationFrame method. To throttle the frame rate, I use setTimeout.
Is there a better / more efficient way to do this?
// Game - animation loop
var fps = 5;
function step() {
setTimeout(function() {
update();
draw();
window.requestAnimationFrame(step);
}, 1000 / fps);
}
Thanks