Skip to content

Commit 5241b92

Browse files
committed
Revert "update: renderjs android 5"
This reverts commit c80e7c0.
1 parent c80e7c0 commit 5241b92

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

pages/component/canvas/canvas.vue

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
</template>
1717

1818
<script module="animate" lang="renderjs">
19-
function Ball(options) {
20-
var x = options.x
21-
var y = options.y
22-
var vx = options.vx
23-
var vy = options.vy
24-
var canvasWidth = options.canvasWidth
25-
var canvasHeight = options.canvasHeight
26-
var ctx = options.ctx
19+
function Ball({
20+
x,
21+
y,
22+
vx,
23+
vy,
24+
canvasWidth,
25+
canvasHeight,
26+
ctx
27+
}) {
2728
this.canvasWidth = canvasWidth
2829
this.canvasHeight = canvasHeight
2930
this.ctx = ctx
@@ -75,33 +76,33 @@
7576
7677
export default {
7778
methods: {
78-
start: function(newVal, oldVal, owner, ins) {
79-
var canvasWidth = ins.getDataset().width,
79+
start(newVal, oldVal, owner, ins) {
80+
let canvasWidth = ins.getDataset().width,
8081
canvasHeight = ins.getDataset().height,
8182
canvasEle = document.querySelectorAll('.canvas>canvas')[0],
8283
ctx = canvasEle.getContext('2d'),
8384
speed = 3,
8485
ballList = [],
8586
layer = 3,
8687
ballInlayer = 20
87-
for (var i = 0; i < layer; i++) {
88-
var radius = getDistance(canvasWidth / 2, canvasHeight / 2) / layer * i
89-
for (var j = 0; j < ballInlayer; j++) {
90-
var deg = j * 2 * Math.PI / ballInlayer,
88+
for (let i = 0; i < layer; i++) {
89+
let radius = getDistance(canvasWidth / 2, canvasHeight / 2) / layer * i
90+
for (let j = 0; j < ballInlayer; j++) {
91+
let deg = j * 2 * Math.PI / ballInlayer,
9192
sin = Math.sin(deg),
9293
cos = Math.cos(deg),
9394
x = radius * cos + canvasWidth / 2,
9495
y = radius * sin + canvasHeight / 2,
9596
vx = speed * cos,
9697
vy = speed * sin
9798
ballList.push(new Ball({
98-
x: x,
99-
y: y,
100-
vx: vx,
101-
vy: vy,
102-
canvasWidth: canvasWidth,
103-
canvasHeight: canvasHeight,
104-
ctx: ctx,
99+
x,
100+
y,
101+
vx,
102+
vy,
103+
canvasWidth,
104+
canvasHeight,
105+
ctx,
105106
radius: 5
106107
}))
107108
}

0 commit comments

Comments
 (0)