-
Notifications
You must be signed in to change notification settings - Fork 0
/
CenterBox.js
39 lines (33 loc) · 978 Bytes
/
CenterBox.js
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
31
32
33
34
35
36
37
38
39
class CenterBox {
constructor(x, y, w, h, rows, cols, colorX, colorY, obj) {
this.x = x;
this.y = y;
this.w = w
this.h = h;
this.rows = rows;
this.cols = cols;
this.colorX = colorX;
this.colorY = colorY;
this.obj = obj;
}
show() {
this.drawCheckBoardBox();
}
drawCheckBoardBox() {
this.obj.stroke(80);
for (var i = 0; i < this.rows; i++) {
for (var j = 0; j < this.cols; j++) {
let xCor = i * this.h + this.x;
let yCor = j * this.h + this.y;
if ((i + j) % 2 == 0) {
scribble.scribbleFilling([xCor, xCor + 42, xCor + 42, xCor], [yCor + 42, yCor + 42, yCor, yCor], gap, angleScribble);
//this.obj.fill(this.colorX);
} else {
//this.obj.fill(this.colorY);
}
//scribble.scribbleRect(xCor + 13, yCor + 14, this.h, this.h);
this.obj.rect(i * this.h + this.x, j * this.h + this.y, this.h, this.h);
}
}
}
}