提交 b06983f9 编写于 作者: 雪洛's avatar 雪洛

Revert "fix: 修复语法错误"

This reverts commit d5f99445.
上级 f8315561
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup>
class Ball { class Ball {
private canvasWidth : number private canvasWidth : number
private canvasHeight : number private canvasHeight : number
...@@ -81,16 +81,16 @@ ...@@ -81,16 +81,16 @@
let canvasWidth = this.ctx.canvas.width, let canvasWidth = this.ctx.canvas.width,
canvasHeight = this.ctx.canvas.height canvasHeight = this.ctx.canvas.height
for (let i = 0; i < this.layer; i++) { for (let i = 0; i < this.layer; i++) {
let radius = this.getDistance(canvasWidth / 2, canvasHeight / 2) / this.layer * i let radius = getDistance(canvasWidth / 2, canvasHeight / 2) / layer * i
for (let j = 0; j < this.ballInlayer; j++) { for (let j = 0; j < this.ballInlayer; j++) {
let deg = j * 2 * Math.PI / this.ballInlayer, let deg = j * 2 * Math.PI / ballInlayer,
sin = Math.sin(deg), sin = Math.sin(deg),
cos = Math.cos(deg), cos = Math.cos(deg),
x = radius * cos + canvasWidth / 2, x = radius * cos + canvasWidth / 2,
y = radius * sin + canvasHeight / 2, y = radius * sin + canvasHeight / 2,
vx = this.speed * cos, vx = this.speed * cos,
vy = this.speed * sin vy = this.speed * sin
this.ballList.push(new Ball(x, y, vx, vy, this.ctx)) ballList.push(new Ball(x, y, vx, vy, ctx))
} }
} }
} }
...@@ -107,8 +107,8 @@ ...@@ -107,8 +107,8 @@
start(){ start(){
//Todo.. requestAnimationFrame //Todo.. requestAnimationFrame
clearInterval(this.interval) clearInterval(this.interval)
this.interval = setInterval(() => { interval = setInterval(function() {
this.animate(this.ballList) animate(ballList)
}, 17) }, 17)
} }
stop(){ stop(){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册