Javascript - Can't Adjust FrameRate - requestanimationframe

前端 未结 7 2265
被撕碎了的回忆
被撕碎了的回忆 2021-02-06 03:50

I start the loop

function gameLoop(){
   update();
   draw();
   requestAnimFrame(gameLoop);
}

var requestAnimFrame =  window.requestAnimationFrame ||
                  


        
7条回答
  •  眼角桃花
    2021-02-06 04:06

    requestAnimationFrame will run with the maximum achievable frame rate (up to 60 fps). This is because it will always give you the next animation frame.

    The parameter you adjusted is only for the polyfill, which will be active if your browser has no implementation of requestAnimationFrame.

    If you want to try painting at one second for testing purposes, try setInterval instead.

提交回复
热议问题