forked from ofZach/RTP_SFPC_SUMMER20
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
51 lines (47 loc) · 844 Bytes
/
script.js
File metadata and controls
51 lines (47 loc) · 844 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
let seed = 0;
let mode = 0;
function setup() {
createCanvas(600, 600);
background(255);
randomSeed(seed);
}
function draw() {
if (frameCount % 512 == 0) {
mode++;
mode %= 3;
}
background(0);
fill(255);
let n = 15 * 40;
let spacing = noise(0, seed/100);
for(let i = 0; i < n; i++) {
textAlign(RIGHT);
text(
int(random(0, n*6)),
(width/20)+((parseInt(i/spacing)*width/20)%width),
12+(i%40)*15
)
}
switch(mode) {
case 0:
if (frameCount % 128 == 0) {
randomSeed(seed++);
}
break;
case 1:
if (frameCount % 5 == 0) {
seed++
}
break;
case 2:
if (frameCount % 56 == 0) {
seed = sin(frameCount*0.5)*width;
}
break;
}
}
function mouseClicked() {
randomSeed(seed++);
mode++;
mode %= 3;
}