Skip to content

Commit

Permalink
add an artwork 20240802
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitsuha Miyake authored and Mitsuha Miyake committed Aug 2, 2024
1 parent 1a99699 commit a4f4359
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 0 deletions.
4 changes: 4 additions & 0 deletions works/20240802/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/20240802/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/20240802/img/image_155.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/20240802/img/image_1946.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/20240802/img/image_2385.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/20240802/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>
93 changes: 93 additions & 0 deletions works/20240802/js/sketch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
let seed = 2550;
let rSeed;

let start = 100;

let rep = 150;

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 c = floor(random(6));
console.log(c);

let space = 1;
for (let j = 0; j < rep; j++) {
push();
translate(random(-width / 2, width / 2), random(-height / 2, height / 2));
for (let i = 0; i < 10; i++) {
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, -100, 100);

let r, g, b;

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

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 a4f4359

Please sign in to comment.