From 597da07bc537ba187808716a62f7df3f18d23fe7 Mon Sep 17 00:00:00 2001 From: hdx Date: Thu, 8 Aug 2024 16:00:47 +0800 Subject: [PATCH] =?UTF-8?q?cancel-animation-frame:=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cancel-animation-frame/cancel-animation-frame.uvue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pages/API/cancel-animation-frame/cancel-animation-frame.uvue b/pages/API/cancel-animation-frame/cancel-animation-frame.uvue index 074f46c7..ffa70810 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() }) }, -- GitLab