提交 801c0fcb 编写于 作者: H hdx

ball: 使用全局 AnimationFrame

上级 22c2db07
...@@ -96,20 +96,20 @@ ...@@ -96,20 +96,20 @@
if (!this.runningFlag) { if (!this.runningFlag) {
return return
} }
this._animateResult = uni.requestAnimationFrame((_: number) => { this._animateResult = requestAnimationFrame((_: number) => {
this.animate() this.animate()
}) })
} }
start() { start() {
uni.cancelAnimationFrame(this._animateResult) cancelAnimationFrame(this._animateResult)
this.runningFlag = true this.runningFlag = true
this.animate() this.animate()
} }
stop() { stop() {
this.runningFlag = false this.runningFlag = false
uni.cancelAnimationFrame(this._animateResult) cancelAnimationFrame(this._animateResult)
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册