diff --git a/pages/API/cancel-animation-frame/cancel-animation-frame.uvue b/pages/API/cancel-animation-frame/cancel-animation-frame.uvue index 074f46c711ff2d7c76c98afa9d1e7427f4bb9d74..ffa708109a19b02b394efcdc7fc26b0316216fae 100644 --- a/pages/API/cancel-animation-frame/cancel-animation-frame.uvue +++ b/pages/API/cancel-animation-frame/cancel-animation-frame.uvue @@ -5,7 +5,7 @@ FPS: {{fps}} FrameCount: {{testFrameCount}} - 提示: 在当前测试例子中,调用一次 requestAnimationFrame 帧率翻倍,cancelAnimationFrame 后恢复 + 提示: 在当前测试例子中,每增加一次调用 requestAnimationFrame 帧率翻倍,cancelAnimationFrame 后恢复 @@ -28,14 +28,15 @@ }, methods: { startRequestAnimationFrame() { - this.taskId = requestAnimationFrame((timestamp : number) => { - this.testFrameCount++ + this.taskId = requestAnimationFrame((timestamp : number) => { this.frameCount++ if (timestamp - this.lastTime >= 1000) { this.fps = this.frameCount this.frameCount = 0 this.lastTime = timestamp - } + } + + this.testFrameCount++ this.startRequestAnimationFrame() }) },