-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mitsuha Miyake
authored and
Mitsuha Miyake
committed
Jul 31, 2024
1 parent
caa9b5a
commit 52c335d
Showing
7 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# memo | ||
Reference: | ||
|
||
<img src="img/image01.png"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
html, body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
canvas { | ||
display: block; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |