We can lock the game to the browser's framerate by calling start from requestAnimationFrame (and making it recursive. The delta time can be calculated by adding a time service that stores the current time and the delta time. In the next frame, the new delta can be calculated using the currently-stored time.
We can lock the game to the browser's framerate by calling
start
fromrequestAnimationFrame
(and making it recursive. The delta time can be calculated by adding a time service that stores the current time and the delta time. In the next frame, the new delta can be calculated using the currently-stored time.