Skip to content
Advertisement

Tag: requestanimationframe

how to restart a loop requestAnimationFrame

I’m tring to make a game and i want to use window.requestAnimationFrame() to make roles move, the movement seems to be right at first. but there is problem that when i re-trigger move() immediately after triggering pause(), the movement will be faster and faster, i have code blow, move()、pause() and initListener() are functions about movement I guess it’s because when

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

Advertisement