use requestAnimationFrame instead of setInterval for the game loop