-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
55 lines (53 loc) · 1.43 KB
/
background.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
53
54
55
function setup() {
createCanvas(windowWidth, windowHeight).parent("canvas");
frameRate(30);
noStroke();
noiseDetail(5, 0.5);
}
function draw() {
for (let x = 0; x < width; x += 60) {
for (let y = 0; y < height; y += 60) {
push();
let noiseColor = noise(
(frameCount / 1 + x) / 850,
(frameCount / 1 + y) / 850
);
if (Math.floor(noiseColor * 10) == 0) {
// rosso scuro
fill("#FE0000");
} else if (Math.floor(noiseColor * 10) == 1) {
// rosso chiaro
fill("#FF1493");
} else if (Math.floor(noiseColor * 10) == 2) {
// fucsia scuro
fill("#7722F6");
} else if (Math.floor(noiseColor * 10) == 3) {
// fucsia chiaro
fill("#1D64FF");
} else if (Math.floor(noiseColor * 10) == 4) {
// viola scuro
fill("#ABFF38");
} else if (Math.floor(noiseColor * 10) == 5) {
// viola chiaro
fill("#FF6432");
} else if (Math.floor(noiseColor * 10) == 6) {
// blu scuro
fill("#FE3EEF");
} else if (Math.floor(noiseColor * 10) == 7) {
// blu chiaro
fill("#B44EF2");
} else if (Math.floor(noiseColor * 10) == 8) {
// verde scuro
fill("#37C3FF");
} else {
// verde chiaro
fill("#DgFA26");
}
rect(x, y, 60, 60);
pop();
}
}
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}