Skip to content

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