xxxxxxxxxx
let colors = ["#f2edf4", "#ecdc9a", "#e9b66b", "#e27009", "#3e75a7", "#e88da1"];
function setup() {
createCanvas(700, 700);
background(random(colors));
angleMode(DEGREES);
frameRate(1);
blendMode(DIFFERENCE);
stroke("#0ba48f");
strokeWeight(15);
line(width / 2, height / 2, width / 2, height);
no = createGraphics(width, height);
for (let i = 0; i < width * height * 0.05; i++) {
let x = random(width);
let y = random(height);
let r = noise(x / 100, y / 100);
let c = color("#000000");
c.setAlpha(100);
no.stroke(c);
no.circle(x, y, r);
}
image(no, 0, 0);
}
function draw() {
push();
noStroke();
fill(random(colors));
curveTightness(int(random(-20, 20)));
hana(width / 2, height / 2, random(0, width * 0.17));
pop();
if (mouseIsPressed) {
noLoop();
}
}
function hana(x, y, size) {
push();
translate(x, y);
rotate(30 * int(random(13)));
let angleCount = int(5);
for (let i = 0; i < angleCount; i++) {
let angle = 360 / angleCount;
rotate(angle);
hanabira(size);
}
ellipse(0, 0, size / 5, size / 5);
pop();
}
function hanabira(size) {
let len = size;
let k = len / 7 * 5;
let a = k * sqrt(2) / 2;
let no = noise(k / 100, a / 200, frameCount / 30);
k = k * no;
for (let i = -len; i < 0; i++) {
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(-k + a, -k - a);
curveVertex(-len, -len);
curveVertex(-len, -len);
endShape();
let x = -k + a;
let y = -k - a
beginShape();
curveVertex(-len, -len);
curveVertex(-len, -len);
curveVertex(x - a * 2, y + a * 2);
curveVertex(0, 0);
curveVertex(0, 0);
endShape();
}
}