提交 597da07b 编写于 作者: H hdx

cancel-animation-frame: 调整文案

上级 cf185672
......@@ -5,7 +5,7 @@
<button @click="stopRequestAnimationFrame">cancelAnimationFrame</button>
<text class="frame-count">FPS: {{fps}}</text>
<text class="frame-count">FrameCount: {{testFrameCount}}</text>
<text class="tips">提示: 在当前测试例子中,调用一次 requestAnimationFrame 帧率翻倍,cancelAnimationFrame 后恢复</text>
<text class="tips">提示: 在当前测试例子中,每增加一次调用 requestAnimationFrame 帧率翻倍,cancelAnimationFrame 后恢复</text>
</view>
</template>
......@@ -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()
})
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册