xxxxxxxxxx
let palette = ["#A230BC", "#7A2BA0", "#4C2672", "#9276AF", "#C2AACF"];
let bgColor = "#000000";
function setup() {
createCanvas(800, 800);
background(bgColor);
noFill();
frameRate(240);
}
function draw() {
let centerX = width / 2;
let centerY = height / 2;
let centerZ = random(0, 1);
let color = random(0, 1);
let size = random(0, 400);
let numShapes = int(random(4, 4));
// Select a random color from the palette
let colorIndex = int(random(palette.length));
let shapeColor = palette[colorIndex];
// Draw a shape with random vertices
stroke(shapeColor);
beginShape();
for (let i = 0; i < numShapes; i++) {
let angle = map(i, 0, numShapes, 0, TWO_PI);
let x = centerX + cos(angle) * size;
let y = centerY + sin(angle) * size;
vertex(x, y);
}
endShape(CLOSE);
// Move to a new position for the next shape
centerX = random(width);
centerY = random(height);
}