-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw.js
More file actions
30 lines (30 loc) · 919 Bytes
/
draw.js
File metadata and controls
30 lines (30 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
cc.Class({
extends: cc.Component,
properties: {
},
// LIFE-CYCLE CALLBACKS:
onLoad () {
this.graphics=this.getComponent(cc.Graphics);
let windowSize = cc.view.getVisibleSize();
this.A_width = windowSize.width;
this.henghang = 6;
this.LongX = parseInt(this.A_width / this.henghang);
this.drawline();
},
drawline:function(){
let graphics=this.graphics;
graphics.strokeColor.fromHEX('#000000');
for(let i=0;i<5;i++){
graphics.moveTo((i-2)*this.LongX,2*this.LongX);
graphics.lineTo((i-2)*this.LongX,-2*this.LongX);
}
for(let j=0;j<5;j++){
graphics.moveTo(-2*this.LongX,this.LongX*(j-2));
graphics.lineTo(2*this.LongX,this.LongX*(j-2));
}
graphics.stroke();
},
start () {
},
// update (dt) {},
});