I start the loop
function gameLoop(){ update(); draw(); requestAnimFrame(gameLoop); } var requestAnimFrame = window.requestAnimationFrame ||
That's how requestAnimationFrame works. If you want a specific framerate, use setTimeout only.
requestAnimationFrame
setTimeout
Usually you would take a parameter, which is the current time. Compare it to the last frame's time to find out how far along the animation should move.