Skip to content

Commit a4f4359

Browse files
Mitsuha MiyakeMitsuha Miyake
authored andcommitted
add an artwork 20240802
1 parent 1a99699 commit a4f4359

File tree

7 files changed

+112
-0
lines changed

7 files changed

+112
-0
lines changed

works/20240802/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/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/img/image_155.png

460 KB
Loading

works/20240802/img/image_1946.png

457 KB
Loading

works/20240802/img/image_2385.png

464 KB
Loading

works/20240802/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/js/sketch.js

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
let seed = 2550;
2+
let rSeed;
3+
4+
let start = 100;
5+
6+
let rep = 150;
7+
8+
function setup() {
9+
// キャンバスサイズの設定
10+
let canvas = createCanvas(600, 600);
11+
12+
angleMode(DEGREES);
13+
14+
noiseDetail(2, 1);
15+
16+
rSeed = int(random(seed));
17+
console.log(rSeed);
18+
randomSeed(rSeed);
19+
noiseSeed(rSeed);
20+
21+
background(30);
22+
23+
translate(width / 2, height / 2);
24+
25+
let c = floor(random(6));
26+
console.log(c);
27+
28+
let space = 1;
29+
for (let j = 0; j < rep; j++) {
30+
push();
31+
translate(random(-width / 2, width / 2), random(-height / 2, height / 2));
32+
for (let i = 0; i < 10; i++) {
33+
let xoff = map(cos(i) + j, -1, 1, 0, 3);
34+
let yoff = map(sin(i) + j, -1, 1, 0, 3);
35+
36+
let n = noise(xoff + start, yoff + start);
37+
let h = map(n, 0, 1, -100, 100);
38+
39+
let r, g, b;
40+
41+
if (c == 0) {
42+
// blue and purple base
43+
r = map(sin(i), -1, 1, 100, 255);
44+
g = map(h, -100, 100, 0, 150);
45+
b = map(n, 0, 1, 100, 200);
46+
} else if (c == 1) {
47+
// yellow and red base
48+
r = map(sin(i), -1, 1, 100, 255);
49+
b = map(h, -100, 100, 0, 150);
50+
g = map(n, 0, 1, 100, 200);
51+
} else if (c == 2) {
52+
// yellow and red base
53+
g = map(sin(i), -1, 1, 100, 255);
54+
b = map(h, -100, 100, 0, 150);
55+
r = map(n, 0, 1, 100, 200);
56+
} else if (c == 3) {
57+
// yellow and red base
58+
g = map(sin(i), -1, 1, 100, 255);
59+
r = map(h, -100, 100, 0, 150);
60+
b = map(n, 0, 1, 100, 200);
61+
} else if (c == 4) {
62+
// pink and yello base
63+
b = map(sin(i), -1, 1, 100, 255);
64+
g = map(h, -100, 100, 0, 150);
65+
r = map(n, 0, 1, 100, 200);
66+
} else if (c == 5) {
67+
// pink and yello base
68+
b = map(sin(i), -1, 1, 100, 255);
69+
r = map(h, -100, 100, 0, 150);
70+
g = map(n, 0, 1, 100, 200);
71+
}
72+
for (let k = 0; k < 360; k += space) {
73+
rotate(space);
74+
noStroke();
75+
fill(r, g, b, 30);
76+
rect(0, 0, h, 1);
77+
}
78+
}
79+
pop();
80+
}
81+
}
82+
83+
function mouseClicked() {
84+
window.location.reload();
85+
}
86+
87+
function keyPressed() {
88+
if (key == "s") {
89+
var scripts = document.getElementsByTagName("sketch").src;
90+
console.log(scripts);
91+
saveCanvas(canvas, "image_" + rSeed, "png");
92+
}
93+
}

0 commit comments

Comments
 (0)