提交 148351ea 编写于 作者: H hdx

canvas/ball: requestAnimationFrame/cancelAnimationFrame 调用缺少uni.

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