-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketch.js
52 lines (38 loc) · 1.03 KB
/
sketch.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
40
41
42
43
44
45
46
47
48
49
50
51
52
//3d Chessboard
var x;
var y;
var square;
var my3d;
function setup() {
createCanvas(800, 800,WEBGL);
x=width/8;
y=height/8;
my3d=0.05
square = {
xpos: x,
ypos: y,
size: x
}
}
function draw () {
background(255);
fill(200)
rotateX(my3d);
rotateY(my3d);
rotateZ(my3d+3);
translate(-400,-400,0);
fill(0);
for(let i=0; i<9; i++){
line(0, y*i, width, y*i);
line(x*i, 0, x*i, height);
rect(square.xpos*2*i+x, square.ypos-y, square.size, square.size);
rect(square.xpos*2*i, square.ypos-y+y, square.size, square.size);
rect(square.xpos*2*i+x, square.ypos+y, square.size, square.size);
rect(square.xpos*2*i, square.ypos+y+y, square.size, square.size);
rect(square.xpos*2*i+x, square.ypos+y+y+y, square.size, square.size);
rect(square.xpos*2*i, square.ypos+y+y+y+y, square.size, square.size);
rect(square.xpos*2*i+x, square.ypos+y+y+y+y+y, square.size, square.size);
rect(square.xpos*2*i, square.ypos+y+y+y+y+y+y, square.size, square.size);
}
my3d=my3d+0.002;
}