-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwave.js
39 lines (29 loc) · 779 Bytes
/
wave.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
var inc = 0;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
angleMode(DEGREES);
}
function draw() {
background("#24242a");
orbitControl();
rotateX(60);
noFill();
//stroke(255, 0,0);
for(var i = 0; i < 20; i++) {
var r = map(sin(frameCount/ 2), -1, 1, 100, 200);
var g = map(i, 0, 20, 100, 200);
var b = map(cos(frameCount), -i, 1, 200, 100);
stroke(r,g,b);
rotate(inc);
beginShape();
for(var j = 0; j < 360; j+= 90) {
var rad = i * 8;
var x = rad * cos(j);
var y = rad * sin(j);
var z = cos(frameCount + i * 10) * 50;
inc += 0.0001;
vertex(x,y,z)
}
endShape(CLOSE);
}
}