p5((s) => {
let system, H, W;
W = form.width;
H = form.height;
let bg, c1, c2, c3, c4;
bg = getColor();
c1 = s.color(getColor());
c2 = s.color(getColor());
c3 = s.color(getColor());
c4 = s.color(getColor());
let x, y, nfx, wh, nf, ct;
s.setup = function () {
s.createCanvas(W, H);
s.noStroke();
nf = form.nf;
ct = 0;
};
s.draw = function () {
ct = 0;
while (ct < 100) {
x = s.random(W);
y = s.random(H);
nfx = s.noise(x * nf, y * nf);
s.push();
s.translate(x, y);
s.rotate(Math.PI * nfx);
wh = s.random(form.scale) * s.sin(0.02 * s.frameCount);
if (nfx < 0.1) {
s.fill(c1);
noisy_rect(0, 0, wh, wh, 1);
}
if (nfx > 0.1 && nfx < 0.2) {
s.fill(c2);
noisy_rect(0, 0, wh, wh, 1);
}
if (nfx > 0.2 && nfx < 0.3) {
s.fill(c3);
noisy_rect(0, 0, wh, wh, 1);
}
if (nfx > 0.3 && nfx < 0.4) {
s.fill(c4);
noisy_rect(0, 0, wh, wh, 1);
}
if (nfx > 0.4 && nfx < 0.5) {
s.fill(c1);
noisy_rect(0, 0, wh, wh, 1);
}
if (nfx > 0.5 && nfx < 0.6) {
s.fill(c2);
noisy_rect(0, 0, wh, wh, 1);
}
if (nfx > 0.6 && nfx < 0.7) {
s.fill(c3);
noisy_rect(0, 0, wh, wh, 2);
}
if (nfx > 0.7 && nfx < 0.8) {
s.fill(c4);
noisy_rect(0, 0, wh, wh, 2);
}
if (nfx > 0.8 && nfx < 0.9) {
s.fill(c1);
noisy_rect(0, 0, wh, wh, 2);
}
if (nfx > 0.9) {
s.fill(c2);
noisy_rect(0, 0, wh, wh, 2);
}
s.pop();
ct += 1;
}
};
const noisy_rect = (x, y, w, h, r) => {
s.noStroke();
let cnt = 0;
while (cnt < 100) {
let ix = s.random(w);
let iy = s.random(h);
s.ellipse(ix, iy, r, r);
cnt += 1;
}
};
})