Skip to content

Commit 92fe14f

Browse files
committed
Cube
1 parent 174fe8e commit 92fe14f

File tree

6 files changed

+88
-3
lines changed

6 files changed

+88
-3
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1+
.DS_Store
12
_site
23
.sass-cache
3-
.DS_Store
4-

P5/cube.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
let width = 700;
2+
let height = 480;
3+
4+
let size = 20;
5+
let num = 16;
6+
let border = 6;
7+
8+
let time = 0;
9+
10+
function setup() {
11+
createCanvas(width, height, WEBGL);
12+
ortho();
13+
}
14+
15+
function draw() {
16+
background(255);
17+
fill(150);
18+
rotateX(-asin(tan(PI/6)));
19+
rotateY(PI/4);
20+
orbitControl();
21+
22+
for (var z = 0; z < num; z++) {
23+
for (var x = 0; x < num; x++) {
24+
push();
25+
var r = dist((x-num/2)*size + size/2, (z-num/2)*size + size/2,0,0);
26+
var h = floor(140 + 80*cos(0.027*r - time));
27+
translate((x-num/2)*size + size/2, 0, (z-num/2)*size + size/2);
28+
normalMaterial();
29+
box(size-border, h, size-border);
30+
pop();
31+
}
32+
}
33+
34+
time += 0.075;
35+
36+
}

P5/p5.dom.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

P5/p5.min.js

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

P5/p5.sound.min.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
<div class="home">
66

77
<br><br><br><br>
8-
<center><h1>PAGE UNDER CONSTRUCTION</h1></center>
8+
<div class="cube">
9+
<script src="P5/p5.min.js"></script>
10+
<script src="P5/p5.dom.min.js"></script>
11+
<script src="P5/p5.sound.min.js"></script>
12+
<script src="P5/cube.js"></script>
13+
</div>
914
<br><br><br><br>
1015

1116
<h1 class="page-heading">Posts</h1>

0 commit comments

Comments
 (0)