| name | algorithmic_art |
| description | p5.js ile generative art, flow fields ve interactive visuals oluşturma rehberi. |
🎨 Algorithmic Art
p5.js ile generative art rehberi.
📋 Temel Yapı
function setup() {
createCanvas(800, 600);
background(20);
}
function draw() {
}
🔧 Temel Şekiller
line(x1, y1, x2, y2);
rect(x, y, width, height);
ellipse(x, y, width, height);
point(x, y);
fill(r, g, b, alpha);
stroke(r, g, b);
noFill();
noStroke();
🌀 Flow Fields
let flowField = [];
let cols, rows;
let scale = 20;
function setup() {
createCanvas(800, 600);
cols = floor(width / scale);
rows = floor(height / scale);
for (let y = 0; y < rows; y++) {
for (let x = 0; x < cols; x++) {
let angle = noise(x * 0.1, y * 0.1) * TWO_PI;
flowField.push(p5.Vector.fromAngle(angle));
}
}
}
✨ Particle Systems
class Particle {
constructor() {
this.pos = createVector(random(width), random(height));
this.vel = createVector(0, 0);
this.acc = createVector(0, 0);
}
update() {
this.vel.add(this.acc);
this.vel.limit(4);
this.pos.add(this.vel);
this.acc.mult(0);
}
show() {
point(this.pos.x, this.pos.y);
}
}
🎲 Seeded Randomness
randomSeed(42);
noiseSeed(42);
let n = noise(x, y);
let r = random(0, 100);
🖱️ Interactivity
function mouseMoved() {
}
function mousePressed() {
}
function keyPressed() {
if (key === 's') {
saveCanvas('artwork', 'png');
}
}
💾 High-Res Export (Print-Ready)
function keyPressed() {
if (key === 's') {
pixelDensity(4);
saveCanvas('artwork_' + frameCount, 'png');
pixelDensity(1);
}
}
🚀 Performance (Shaders)
For pixel-level manipulation, use GLSL shaders in WEBGL mode instead of pixels[] array for 100x speedup.
Algorithmic Art v1.1 - Enhanced
🔄 Workflow
Kaynak: Generative Design Process
Aşama 1: Concept & Rules
Aşama 2: Implementation (Sketching)
Aşama 3: Generative Logic
Aşama 4: Tuning & Curation
Kontrol Noktaları
| Aşama | Doğrulama |
|---|
| 1 | Konsept ve kısıtlamalar net |
| 2 | Temel döngü hatasız çalışıyor |
| 3 | Çıktı her çalıştırıldığında varyasyon gösteriyor |
| 4 | Performans stabil (>30 FPS) |