xxxxxxxxxx
let colors;
function setup() {
createCanvas(640, 640);
colorMode(HSB, 360, 100, 100, 1.0);
background(200, 80, 25);
colors = [
color(0, 0, 100),
color(223, 88, 90, 1.0),
color(156, 88, 90, 1.0),
color(44, 88, 90, 1.0)
];
shuffle(colors, true);
}
let y = 0;
const inc = 4;
const noiseScale = 0.009;
function draw() {
noStroke();
for (var x = 0; x < width; x += inc) {
const d = dist(width / 2, height / 2, x, y);
const n = noise(x * noiseScale, y * noiseScale);
const i = round(map(n * 10, 0, 10, 0, colors.length - 1));
const c = colors[i];
fill(c);
const s = (sin(d / 4)) * map(n, 0, 1, inc / (inc * 2), inc * 0.618);
if (n > 0.5) {
circle(x, y, s);
} else {
rect(x, y, s, s);
}
}
y += inc;
if (y > height) {
noLoop();
}
}