Skip to content

Commit 1a99699

Browse files
Mitsuha MiyakeMitsuha Miyake
authored andcommitted
sort color generator for the artwork 20240730
1 parent c1a8843 commit 1a99699

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

works/20240731/js/sketch.js

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let rSeed;
33

44
let start = 100;
55

6-
let rep = 100;
6+
let rep = 50;
77

88
function setup() {
99
// キャンバスサイズの設定
@@ -37,7 +37,8 @@ function setup() {
3737
}
3838
}
3939

40-
let c = random();
40+
let c = floor(random(6));
41+
console.log(c);
4142

4243
for (let j = 0; j < rep; j++) {
4344
for (let i = 0; i < 360; i += space) {
@@ -48,37 +49,39 @@ function setup() {
4849
let h = map(n, 0, 1, -300, 300);
4950

5051
let r, g, b;
51-
if (c > 5 / 6) {
52+
53+
if (c == 0) {
5254
// blue and purple base
5355
r = map(sin(i), -1, 1, 100, 200);
5456
g = map(h, -150, 150, 0, 150);
5557
b = map(n, 0, 1, 150, 255);
56-
} else if (c > 4 / 6) {
57-
// pink and yello base
58-
b = map(sin(i), -1, 1, 100, 200);
59-
g = map(h, -150, 150, 0, 150);
60-
r = map(n, 0, 1, 150, 255);
61-
} else if (c > 3 / 6) {
58+
} else if (c == 1) {
59+
// yellow and red base
60+
r = map(sin(i), -1, 1, 100, 200);
61+
b = map(h, -150, 150, 0, 150);
62+
g = map(n, 0, 1, 150, 255);
63+
} else if (c == 2) {
6264
// yellow and red base
6365
g = map(sin(i), -1, 1, 100, 200);
6466
b = map(h, -150, 150, 0, 150);
6567
r = map(n, 0, 1, 150, 255);
66-
} else if (c > 2 / 6) {
68+
} else if (c == 3) {
6769
// yellow and red base
6870
g = map(sin(i), -1, 1, 100, 200);
6971
r = map(h, -150, 150, 0, 150);
7072
b = map(n, 0, 1, 150, 255);
71-
} else if (1 / 6) {
72-
// yellow and red base
73-
r = map(sin(i), -1, 1, 100, 200);
74-
b = map(h, -150, 150, 0, 150);
75-
g = map(n, 0, 1, 150, 255);
76-
} else {
77-
// yellow and red base
78-
r = map(sin(i), -1, 1, 100, 200);
79-
b = map(h, -150, 150, 0, 150);
73+
} else if (c == 4) {
74+
// pink and yello base
75+
b = map(sin(i), -1, 1, 100, 200);
76+
g = map(h, -150, 150, 0, 150);
77+
r = map(n, 0, 1, 150, 255);
78+
} else if (c == 5) {
79+
// pink and yello base
80+
b = map(sin(i), -1, 1, 100, 200);
81+
r = map(h, -150, 150, 0, 150);
8082
g = map(n, 0, 1, 150, 255);
8183
}
84+
8285
rotate(space);
8386
noStroke();
8487
fill(r, g, b, 30);

0 commit comments

Comments
 (0)