Skip to content

Commit

Permalink
add an artwork 20240731
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitsuha Miyake authored and Mitsuha Miyake committed Jul 31, 2024
1 parent caa9b5a commit 52c335d
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 0 deletions.
4 changes: 4 additions & 0 deletions works/20240731/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# memo
Reference:

<img src="img/image01.png">
7 changes: 7 additions & 0 deletions works/20240731/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
html, body {
margin: 0;
padding: 0;
}
canvas {
display: block;
}
Binary file added works/20240731/img/image_1266.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added works/20240731/img/image_1768.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added works/20240731/img/image_521.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions works/20240731/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
<script src="js/sketch.js"></script>
</head>
<body>
</body>
</html>
100 changes: 100 additions & 0 deletions works/20240731/js/sketch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
let seed = 2000;
let rSeed;

let start = 100;

let rep = 100;

function setup() {
// キャンバスサイズの設定
let canvas = createCanvas(600, 600);

angleMode(DEGREES);

noiseDetail(2, 1);

rSeed = int(random(seed));
console.log(rSeed);
randomSeed(rSeed);
noiseSeed(rSeed);

background(30);

translate(width / 2, height / 2);

let space = 0.1;
for (let j = 0; j < rep; j++) {
for (let i = 0; i < 360; i += space) {
let xoff = map(cos(i) + j + 1, -1, 1, 0, 3);
let yoff = map(sin(i) + j, -1, 1, 0, 3);

let n = noise(xoff + start, yoff + start);
let h = map(n, 0, 1, -300, 300);

rotate(space);
stroke(255, 255, 255, 30);
point(h, 1);
}
}

let c = random();

for (let j = 0; j < rep; j++) {
for (let i = 0; i < 360; i += space) {
let xoff = map(cos(i) + j, -1, 1, 0, 3);
let yoff = map(sin(i) + j, -1, 1, 0, 3);

let n = noise(xoff + start, yoff + start);
let h = map(n, 0, 1, -300, 300);

let r, g, b;
if (c > 5 / 6) {
// blue and purple base
r = map(sin(i), -1, 1, 100, 200);
g = map(h, -150, 150, 0, 150);
b = map(n, 0, 1, 150, 255);
} else if (c > 4 / 6) {
// pink and yello base
b = map(sin(i), -1, 1, 100, 200);
g = map(h, -150, 150, 0, 150);
r = map(n, 0, 1, 150, 255);
} else if (c > 3 / 6) {
// yellow and red base
g = map(sin(i), -1, 1, 100, 200);
b = map(h, -150, 150, 0, 150);
r = map(n, 0, 1, 150, 255);
} else if (c > 2 / 6) {
// yellow and red base
g = map(sin(i), -1, 1, 100, 200);
r = map(h, -150, 150, 0, 150);
b = map(n, 0, 1, 150, 255);
} else if (1 / 6) {
// yellow and red base
r = map(sin(i), -1, 1, 100, 200);
b = map(h, -150, 150, 0, 150);
g = map(n, 0, 1, 150, 255);
} else {
// yellow and red base
r = map(sin(i), -1, 1, 100, 200);
b = map(h, -150, 150, 0, 150);
g = map(n, 0, 1, 150, 255);
}
rotate(space);
noStroke();
fill(r, g, b, 30);
rect(0, 0, h, 1);
}
}
}

function mouseClicked() {
window.location.reload();
}

function keyPressed() {
if (key == "s") {
var scripts = document.getElementsByTagName("sketch").src;
console.log(scripts);
saveCanvas(canvas, "image_" + rSeed, "png");
}
}

0 comments on commit 52c335d

Please sign in to comment.