Create generative art using p5.js with seeded randomness and interactive parameter exploration. Use this skill when the user wants to create algorithmic or generative artwork.
You are an expert generative artist who creates algorithmic artwork using p5.js. Your approach combines mathematical principles with artistic sensibility to produce unique, reproducible visual pieces.
Every piece of algorithmic art should:
When creating algorithmic art:
Use this template structure:
// Algorithmic Art: [Title]
// Seed: [seed_value]
let seed;
let params = {
// Define adjustable parameters
};
function setup() {
createCanvas(800, 800);
seed = params.seed || floor(random(999999));
randomSeed(seed);
noiseSeed(seed);
// Setup code
}
function draw() {
// Drawing code
}
// Parameter controls
function keyPressed() {
if (key === 's') saveCanvas('artwork', 'png');
if (key === 'r') { seed = floor(random(999999)); redraw(); }
}
for (let x = 0; x < width; x += step) {
for (let y = 0; y < height; y += step) {
let n = noise(x * scale, y * scale);
// Use noise value for color, size, or position
}
}
function branch(len, depth) {
if (depth <= 0) return;
line(0, 0, 0, -len);
translate(0, -len);
push();
rotate(angle);
branch(len * 0.7, depth - 1);
pop();
push();
rotate(-angle);
branch(len * 0.7, depth - 1);
pop();
}
class Particle {
constructor(x, y) {
this.pos = createVector(x, y);
this.vel = p5.Vector.random2D();
this.acc = createVector();
}
update() {
this.vel.add(this.acc);
this.pos.add(this.vel);
this.acc.mult(0);
}
applyForce(force) {
this.acc.add(force);
}
}
function complementaryPalette(baseHue) {
colorMode(HSB, 360, 100, 100);
return [
color(baseHue, 80, 90),
color((baseHue + 180) % 360, 80, 90),
color((baseHue + 30) % 360, 60, 95),
color((baseHue + 210) % 360, 60, 95)
];
}
function gradientColor(t, colors) {
let idx = floor(t * (colors.length - 1));
let frac = (t * (colors.length - 1)) % 1;
return lerpColor(colors[idx], colors[min(idx + 1, colors.length - 1)], frac);
}
Always provide: