Skip to content

Commit c467643

Browse files
Mitsuha MiyakeMitsuha Miyake
authored andcommitted
add an artwork 20240802_2
1 parent c7898cd commit c467643

File tree

7 files changed

+201
-0
lines changed

7 files changed

+201
-0
lines changed

works/20240802_2/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# memo
2+
Reference:
3+
4+
<img src="img/image01.png">

works/20240802_2/css/style.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
html, body {
2+
margin: 0;
3+
padding: 0;
4+
}
5+
canvas {
6+
display: block;
7+
}

works/20240802_2/img/image_179.png

2.33 MB
Loading

works/20240802_2/img/image_2251.png

2.37 MB
Loading

works/20240802_2/img/image_678.png

2.38 MB
Loading

works/20240802_2/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
<head>
3+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
4+
<script src="js/sketch.js"></script>
5+
</head>
6+
<body>
7+
</body>
8+
</html>

works/20240802_2/js/sketch.js

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
let seed = 2550;
2+
let rSeed;
3+
4+
let start = 100;
5+
6+
let rep = 5;
7+
8+
function setup() {
9+
// キャンバスサイズの設定
10+
let canvas = createCanvas(600, 600);
11+
12+
angleMode(DEGREES);
13+
14+
noiseDetail(2, 0.5);
15+
16+
rSeed = int(random(seed));
17+
console.log(rSeed);
18+
randomSeed(rSeed);
19+
noiseSeed(rSeed);
20+
21+
background(30);
22+
23+
let cell_num = 3;
24+
let w = width / cell_num;
25+
let ht = w;
26+
let offset = width / cell_num / 2;
27+
let space = 0.2;
28+
for (let l = 0; l < cell_num; l++) {
29+
for (let k = 0; k < cell_num; k++) {
30+
let c = floor(random(6));
31+
console.log(c);
32+
33+
let cx = l * w + offset;
34+
let cy = k * ht + offset;
35+
push();
36+
translate(cx, cy);
37+
for (let j = 0; j < rep; j++) {
38+
for (let i = 0; i < 360; i += space) {
39+
let xoff = map(cos(i + k * 100) + j, -1, 1, 0, 3);
40+
let yoff = map(sin(i + l * 100) + j, -1, 1, 0, 3);
41+
42+
let n = noise(xoff + start, yoff + start);
43+
let h = map(n, 0, 1, -400, 400);
44+
45+
let r, g, b;
46+
47+
if (c == 0) {
48+
// blue and purple base
49+
r = map(sin(i), -1, 1, 100, 200);
50+
g = map(h, -100, 100, 0, 150);
51+
b = map(n, 0, 1, 100, 200);
52+
} else if (c == 1) {
53+
// yellow and red base
54+
r = map(sin(i), -1, 1, 100, 255);
55+
b = map(h, -100, 100, 0, 150);
56+
g = map(n, 0, 1, 100, 200);
57+
} else if (c == 2) {
58+
// yellow and red base
59+
g = map(sin(i), -1, 1, 100, 255);
60+
b = map(h, -100, 100, 0, 150);
61+
r = map(n, 0, 1, 100, 200);
62+
} else if (c == 3) {
63+
// yellow and red base
64+
g = map(sin(i), -1, 1, 100, 255);
65+
r = map(h, -100, 100, 0, 150);
66+
b = map(n, 0, 1, 100, 200);
67+
} else if (c == 4) {
68+
// pink and yello base
69+
b = map(sin(i), -1, 1, 100, 255);
70+
g = map(h, -100, 100, 0, 150);
71+
r = map(n, 0, 1, 100, 200);
72+
} else if (c == 5) {
73+
// pink and yello base
74+
b = map(sin(i), -1, 1, 100, 255);
75+
r = map(h, -100, 100, 0, 150);
76+
g = map(n, 0, 1, 100, 200);
77+
}
78+
79+
rotate(space);
80+
noStroke();
81+
fill(r, g, b, 30);
82+
rect(0, 0, h, 1);
83+
}
84+
for (let i = 0; i < 360; i += space) {
85+
let xoff = map(cos(i) + j, -1, 1, 0, 3);
86+
let yoff = map(sin(i) + j, -1, 1, 0, 3);
87+
88+
let n = noise(xoff + start + j, yoff + start + j);
89+
let h = map(n, 0, 1, -400, 400);
90+
91+
rotate(space);
92+
stroke(255, 255, 255, 30);
93+
point(h, 0);
94+
}
95+
}
96+
pop();
97+
}
98+
}
99+
for (let l = 0; l < cell_num; l++) {
100+
for (let k = 0; k < cell_num; k++) {
101+
let c = floor(random(6));
102+
console.log(c);
103+
104+
let cx = l * w + offset;
105+
let cy = k * ht + offset;
106+
push();
107+
translate(cx, cy);
108+
for (let j = 0; j < rep; j++) {
109+
for (let i = 0; i < 360; i += space) {
110+
let xoff = map(cos(i + k * 100) + j, -1, 1, 0, 3);
111+
let yoff = map(sin(i + l * 100) + j, -1, 1, 0, 3);
112+
113+
let n = noise(xoff + start, yoff + start);
114+
let h = map(n, 0, 1, -400, 400);
115+
116+
let r, g, b;
117+
118+
if (c == 0) {
119+
// blue and purple base
120+
r = map(sin(i), -1, 1, 100, 200);
121+
g = map(h, -100, 100, 0, 150);
122+
b = map(n, 0, 1, 100, 200);
123+
} else if (c == 1) {
124+
// yellow and red base
125+
r = map(sin(i), -1, 1, 100, 255);
126+
b = map(h, -100, 100, 0, 150);
127+
g = map(n, 0, 1, 100, 200);
128+
} else if (c == 2) {
129+
// yellow and red base
130+
g = map(sin(i), -1, 1, 100, 255);
131+
b = map(h, -100, 100, 0, 150);
132+
r = map(n, 0, 1, 100, 200);
133+
} else if (c == 3) {
134+
// yellow and red base
135+
g = map(sin(i), -1, 1, 100, 255);
136+
r = map(h, -100, 100, 0, 150);
137+
b = map(n, 0, 1, 100, 200);
138+
} else if (c == 4) {
139+
// pink and yello base
140+
b = map(sin(i), -1, 1, 100, 255);
141+
g = map(h, -100, 100, 0, 150);
142+
r = map(n, 0, 1, 100, 200);
143+
} else if (c == 5) {
144+
// pink and yello base
145+
b = map(sin(i), -1, 1, 100, 255);
146+
r = map(h, -100, 100, 0, 150);
147+
g = map(n, 0, 1, 100, 200);
148+
}
149+
150+
rotate(space);
151+
noStroke();
152+
fill(r, g, b, 30);
153+
rect(0, 0, h, 1);
154+
}
155+
for (let i = 0; i < 360; i += space) {
156+
let xoff = map(cos(i) + j, -1, 1, 0, 3);
157+
let yoff = map(sin(i) + j, -1, 1, 0, 3);
158+
159+
let n = noise(xoff + start + j, yoff + start + j);
160+
let h = map(n, 0, 1, -400, 400);
161+
162+
rotate(space);
163+
stroke(255, 255, 255, 30);
164+
point(h, 1);
165+
}
166+
}
167+
pop();
168+
}
169+
}
170+
}
171+
172+
function mouseClicked() {
173+
window.location.reload();
174+
}
175+
176+
function keyPressed() {
177+
if (key == "s") {
178+
var scripts = document.getElementsByTagName("sketch").src;
179+
console.log(scripts);
180+
saveCanvas(canvas, "image_" + rSeed, "png");
181+
}
182+
}

0 commit comments

Comments
 (0)