xxxxxxxxxx
let pallete;
let bg;
function setup() {
createCanvas(800, 800);
noLoop();
rectMode(CENTER);
pallete = ["#b80c09", "#0b4f6c", "#01baef", "#fbfbff", "#040f16"];
bg = createGraphics(width, height);
bg.noFill();
bg.strokeWeight(0.5);
for (let i = 0; i < 100000; i++) {
let x = random(width);
let y = random(height);
let s = random(10);
let ns = 0.002;
bg.stroke(noise(x * ns, y * ns) * 255, 50);
bg.rect(x, y, s, s);
}
}
function draw() {
let cx = width / 2;
let cy = height / 2;
let points = [];
let count = 100000;
background(255);
image(bg, 0, 0);
for (let i = 0; i < count; i++) {
let a = random(TWO_PI);
let d = random(width * 0.8);
let x = cx + cos(a) * d;
let y = cy + sin(a) * d;
let s = map(dist(0, y, 0, 0), 0, height, 10, 300);
let add = true;
for (let j = 0; j < points.length; j++) {
let p = points[j];
if (dist(x, y, p.x, p.y) < (s + p.z) * 0.5) {
add = false;
break;
}
}
if (add) points.push(createVector(x, y, s));
}
for (let i = 0; i < points.length; i++) {
let p = points[i];
form(p.x, p.y, p.z * 0.85);
}
}
function form(x, y, s) {
noStroke();
fill(0, 5);
for (let i = 0; i < 100; i++) {
let w = map(i, 0, 100, 0, s);
let h = map(i, 0, 100, 0, s * 0.1);
ellipse(x, y + s / 2, w, h);
}
noStroke();
push();
translate(x, y);
rotate(random(TAU));
fill(0, 10);
for (let i = 0; i < 50; i++) {
let a = map(i, 0, 49, 0, PI * 0.8)
arc(0, 0, s, s, -a, a, OPEN);
}
pop();
}
function keyPressed() {
redraw();
}