From 148351eae35f0d5ac586b994cd0601e94173d7d0 Mon Sep 17 00:00:00 2001 From: hdx Date: Fri, 2 Aug 2024 14:27:17 +0800 Subject: [PATCH] =?UTF-8?q?canvas/ball:=20requestAnimationFrame/cancelAnim?= =?UTF-8?q?ationFrame=20=E8=B0=83=E7=94=A8=E7=BC=BA=E5=B0=91uni.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/canvas/canvas/ball.uvue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/component/canvas/canvas/ball.uvue b/pages/component/canvas/canvas/ball.uvue index b60a53b3..df16a2e5 100644 --- a/pages/component/canvas/canvas/ball.uvue +++ b/pages/component/canvas/canvas/ball.uvue @@ -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) } } -- GitLab