Skip to content
Advertisement

requestAnimationFrame Refresh Rate

I’m using requestAnimationFrame to draw players in my game. One of the players is moving faster than everybody else. I did some checking with him and he told me that his monitor has a 120hz refresh rate. I’m assuming this means has can process frames faster than others resulting in faster movement speed. Any ideas as to how I can get around this?

Thanks

The shim layer used is below:

JavaScript

Advertisement

Answer

There is no guaranteed framerate. However, you can force an approximate framerate using a simple timer: How to solve different FPS in requestAnimationFrame on different browsers?

Advertisement