SKILL.md
SKILL.mdBrowse 17 files
6,887 tokens
27,534 bytes
Token encoding: o200k_base
Snapshot 24fd22b
1---2name: p5js3description: "p5.js sketches: gen art, shaders, interactive, 3D."4version: 1.0.05author: SHL0MS, Hermes Agent6license: MIT7platforms: [linux, macos, windows]8metadata:9 hermes:10 tags: [creative-coding, generative-art, p5js, canvas, interactive, visualization, webgl, shaders, animation]11 related_skills: [ascii-video, manim-video, excalidraw]12---13 14# p5.js Production Pipeline15 16## When to use17 18Use when users request: p5.js sketches, creative coding, generative art, interactive visualizations, canvas animations, browser-based visual art, data viz, shader effects, or any p5.js project.19 20## What's inside21 22Production pipeline for interactive and generative visual art using p5.js. Creates browser-based sketches, generative art, data visualizations, interactive experiences, 3D scenes, audio-reactive visuals, and motion graphics — exported as HTML, PNG, GIF, MP4, or SVG. Covers: 2D/3D rendering, noise and particle systems, flow fields, shaders (GLSL), pixel manipulation, kinetic typography, WebGL scenes, audio analysis, mouse/keyboard interaction, and headless high-res export.23 24## Creative Standard25 26This is visual art rendered in the browser. The canvas is the medium; the algorithm is the brush.27 28**Before writing a single line of code**, articulate the creative concept. What does this piece communicate? What makes the viewer stop scrolling? What separates this from a code tutorial example? The user's prompt is a starting point — interpret it with creative ambition.29 30**First-render excellence is non-negotiable.** The output must be visually striking on first load. If it looks like a p5.js tutorial exercise, a default configuration, or "AI-generated creative coding," it is wrong. Rethink before shipping.31 32**Go beyond the reference vocabulary.** The noise functions, particle systems, color palettes, and shader effects in the references are a starting vocabulary. For every project, combine, layer, and invent. The catalog is a palette of paints — you write the painting.33 34**Be proactively creative.** If the user asks for "a particle system," deliver a particle system with emergent flocking behavior, trailing ghost echoes, palette-shifted depth fog, and a background noise field that breathes. Include at least one visual detail the user didn't ask for but will appreciate.35 36**Dense, layered, considered.** Every frame should reward viewing. Never flat white backgrounds. Always compositional hierarchy. Always intentional color. Always micro-detail that only appears on close inspection.37 38**Cohesive aesthetic over feature count.** All elements must serve a unified visual language — shared color temperature, consistent stroke weight vocabulary, harmonious motion speeds. A sketch with ten unrelated effects is worse than one with three that belong together.39 40## Modes41 42| Mode | Input | Output | Reference |43|------|-------|--------|-----------|44| **Generative art** | Seed / parameters | Procedural visual composition (still or animated) | `references/visual-effects.md` |45| **Data visualization** | Dataset / API | Interactive charts, graphs, custom data displays | `references/interaction.md` |46| **Interactive experience** | None (user drives) | Mouse/keyboard/touch-driven sketch | `references/interaction.md` |47| **Animation / motion graphics** | Timeline / storyboard | Timed sequences, kinetic typography, transitions | `references/animation.md` |48| **3D scene** | Concept description | WebGL geometry, lighting, camera, materials | `references/webgl-and-3d.md` |49| **Image processing** | Image file(s) | Pixel manipulation, filters, mosaic, pointillism | `references/visual-effects.md` § Pixel Manipulation |50| **Audio-reactive** | Audio file / mic | Sound-driven generative visuals | `references/interaction.md` § Audio Input |51 52## Stack53 54Single self-contained HTML file per project. No build step required.55 56| Layer | Tool | Purpose |57|-------|------|---------|58| Core | p5.js 1.11.3 (CDN) | Canvas rendering, math, transforms, event handling |59| 3D | p5.js WebGL mode | 3D geometry, camera, lighting, GLSL shaders |60| Audio | p5.sound.js (CDN) | FFT analysis, amplitude, mic input, oscillators |61| Export | Built-in `saveCanvas()` / `saveGif()` / `saveFrames()` | PNG, GIF, frame sequence output |62| Capture | CCapture.js (optional) | Deterministic framerate video capture (WebM, GIF) |63| Headless | Puppeteer + Node.js (optional) | Automated high-res rendering, MP4 via ffmpeg |64| SVG | p5.js-svg 1.6.0 (optional) | Vector output for print — requires p5.js 1.x |65| Natural media | p5.brush (optional) | Watercolor, charcoal, pen — requires p5.js 2.x + WEBGL |66| Texture | p5.grain (optional) | Film grain, texture overlays |67| Fonts | Google Fonts / `loadFont()` | Custom typography via OTF/TTF/WOFF2 |68 69### Version Note70 71**p5.js 1.x** (1.11.3) is the default — stable, well-documented, broadest library compatibility. Use this unless a project requires 2.x features.72 73**p5.js 2.x** (2.2+) adds: `async setup()` replacing `preload()`, OKLCH/OKLAB color modes, `splineVertex()`, shader `.modify()` API, variable fonts, `textToContours()`, pointer events. Required for p5.brush. See `references/core-api.md` § p5.js 2.0.74 75## Pipeline76 77Every project follows the same 6-stage path:78 79```80CONCEPT → DESIGN → CODE → PREVIEW → EXPORT → VERIFY81```82 831. **CONCEPT** — Articulate the creative vision: mood, color world, motion vocabulary, what makes this unique842. **DESIGN** — Choose mode, canvas size, interaction model, color system, export format. Map concept to technical decisions853. **CODE** — Write single HTML file with inline p5.js. Structure: globals → `preload()` → `setup()` → `draw()` → helpers → classes → event handlers864. **PREVIEW** — Open in browser, verify visual quality. Test at target resolution. Check performance875. **EXPORT** — Capture output: `saveCanvas()` for PNG, `saveGif()` for GIF, `saveFrames()` + ffmpeg for MP4, Puppeteer for headless batch886. **VERIFY** — Does the output match the concept? Is it visually striking at the intended display size? Would you frame it?89 90## Creative Direction91 92### Aesthetic Dimensions93 94| Dimension | Options | Reference |95|-----------|---------|-----------|96| **Color system** | HSB/HSL, RGB, named palettes, procedural harmony, gradient interpolation | `references/color-systems.md` |97| **Noise vocabulary** | Perlin noise, simplex, fractal (octaved), domain warping, curl noise | `references/visual-effects.md` § Noise |98| **Particle systems** | Physics-based, flocking, trail-drawing, attractor-driven, flow-field following | `references/visual-effects.md` § Particles |99| **Shape language** | Geometric primitives, custom vertices, bezier curves, SVG paths | `references/shapes-and-geometry.md` |100| **Motion style** | Eased, spring-based, noise-driven, physics sim, lerped, stepped | `references/animation.md` |101| **Typography** | System fonts, loaded OTF, `textToPoints()` particle text, kinetic | `references/typography.md` |102| **Shader effects** | GLSL fragment/vertex, filter shaders, post-processing, feedback loops | `references/webgl-and-3d.md` § Shaders |103| **Composition** | Grid, radial, golden ratio, rule of thirds, organic scatter, tiled | `references/core-api.md` § Composition |104| **Interaction model** | Mouse follow, click spawn, drag, keyboard state, scroll-driven, mic input | `references/interaction.md` |105| **Blend modes** | `BLEND`, `ADD`, `MULTIPLY`, `SCREEN`, `DIFFERENCE`, `EXCLUSION`, `OVERLAY` | `references/color-systems.md` § Blend Modes |106| **Layering** | `createGraphics()` offscreen buffers, alpha compositing, masking | `references/core-api.md` § Offscreen Buffers |107| **Texture** | Perlin surface, stippling, hatching, halftone, pixel sorting | `references/visual-effects.md` § Texture Generation |108 109### Per-Project Variation Rules110 111Never use default configurations. For every project:112- **Custom color palette** — never raw `fill(255, 0, 0)`. Always a designed palette with 3-7 colors113- **Custom stroke weight vocabulary** — thin accents (0.5), medium structure (1-2), bold emphasis (3-5)114- **Background treatment** — never plain `background(0)` or `background(255)`. Always textured, gradient, or layered115- **Motion variety** — different speeds for different elements. Primary at 1x, secondary at 0.3x, ambient at 0.1x116- **At least one invented element** — a custom particle behavior, a novel noise application, a unique interaction response117 118### Project-Specific Invention119 120For every project, invent at least one of:121- A custom color palette matching the mood (not a preset)122- A novel noise field combination (e.g., curl noise + domain warp + feedback)123- A unique particle behavior (custom forces, custom trails, custom spawning)124- An interaction mechanic the user didn't request but that elevates the piece125- A compositional technique that creates visual hierarchy126 127### Parameter Design Philosophy128 129Parameters should emerge from the algorithm, not from a generic menu. Ask: "What properties of *this* system should be tunable?"130 131**Good parameters** expose the algorithm's character:132- **Quantities** — how many particles, branches, cells (controls density)133- **Scales** — noise frequency, element size, spacing (controls texture)134- **Rates** — speed, growth rate, decay (controls energy)135- **Thresholds** — when does behavior change? (controls drama)136- **Ratios** — proportions, balance between forces (controls harmony)137 138**Bad parameters** are generic controls unrelated to the algorithm:139- "color1", "color2", "size" — meaningless without context140- Toggle switches for unrelated effects141- Parameters that only change cosmetics, not behavior142 143Every parameter should change how the algorithm *thinks*, not just how it *looks*. A "turbulence" parameter that changes noise octaves is good. A "particle size" slider that only changes `ellipse()` radius is shallow.144 145## Workflow146 147### Step 1: Creative Vision148 149Before any code, articulate:150 151- **Mood / atmosphere**: What should the viewer feel? Contemplative? Energized? Unsettled? Playful?152- **Visual story**: What happens over time (or on interaction)? Build? Decay? Transform? Oscillate?153- **Color world**: Warm/cool? Monochrome? Complementary? What's the dominant hue? The accent?154- **Shape language**: Organic curves? Sharp geometry? Dots? Lines? Mixed?155- **Motion vocabulary**: Slow drift? Explosive burst? Breathing pulse? Mechanical precision?156- **What makes THIS different**: What is the one thing that makes this sketch unique?157 158Map the user's prompt to aesthetic choices. "Relaxing generative background" demands different everything from "glitch data visualization."159 160### Step 2: Technical Design161 162- **Mode** — which of the 7 modes from the table above163- **Canvas size** — landscape 1920x1080, portrait 1080x1920, square 1080x1080, or responsive `windowWidth/windowHeight`164- **Renderer** — `P2D` (default) or `WEBGL` (for 3D, shaders, advanced blend modes)165- **Frame rate** — 60fps (interactive), 30fps (ambient animation), or `noLoop()` (static generative)166- **Export target** — browser display, PNG still, GIF loop, MP4 video, SVG vector167- **Interaction model** — passive (no input), mouse-driven, keyboard-driven, audio-reactive, scroll-driven168- **Viewer UI** — for interactive generative art, start from `templates/viewer.html` which provides seed navigation, parameter sliders, and download. For simple sketches or video export, use bare HTML169 170### Step 3: Code the Sketch171 172For **interactive generative art** (seed exploration, parameter tuning): start from `templates/viewer.html`. Read the template first, keep the fixed sections (seed nav, actions), replace the algorithm and parameter controls. This gives the user seed prev/next/random/jump, parameter sliders with live update, and PNG download — all wired up.173 174For **animations, video export, or simple sketches**: use bare HTML:175 176Single HTML file. Structure:177 178```html179<!DOCTYPE html>180<html lang="en">181<head>182 <meta charset="UTF-8">183 <meta name="viewport" content="width=device-width, initial-scale=1.0">184 <title>Project Name</title>185 <script>p5.disableFriendlyErrors = true;</script>186 <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.3/p5.min.js"></script>187 <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.3/addons/p5.sound.min.js"></script> -->188 <!-- <script src="https://unpkg.com/p5.js-svg@1.6.0"></script> --> <!-- SVG export -->189 <!-- <script src="https://cdn.jsdelivr.net/npm/ccapture.js-npmfixed/build/CCapture.all.min.js"></script> --> <!-- video capture -->190 <style>191 html, body { margin: 0; padding: 0; overflow: hidden; }192 canvas { display: block; }193 </style>194</head>195<body>196<script>197// === Configuration ===198const CONFIG = {199 seed: 42,200 // ... project-specific params201};202 203// === Color Palette ===204const PALETTE = {205 bg: '#0a0a0f',206 primary: '#e8d5b7',207 // ...208};209 210// === Global State ===211let particles = [];212 213// === Preload (fonts, images, data) ===214function preload() {215 // font = loadFont('...');216}217 218// === Setup ===219function setup() {220 createCanvas(1920, 1080);221 randomSeed(CONFIG.seed);222 noiseSeed(CONFIG.seed);223 colorMode(HSB, 360, 100, 100, 100);224 // Initialize state...225}226 227// === Draw Loop ===228function draw() {229 // Render frame...230}231 232// === Helper Functions ===233// ...234 235// === Classes ===236class Particle {237 // ...238}239 240// === Event Handlers ===241function mousePressed() { /* ... */ }242function keyPressed() { /* ... */ }243function windowResized() { resizeCanvas(windowWidth, windowHeight); }244</script>245</body>246</html>247```248 249Key implementation patterns:250- **Seeded randomness**: Always `randomSeed()` + `noiseSeed()` for reproducibility251- **Color mode**: Use `colorMode(HSB, 360, 100, 100, 100)` for intuitive color control252- **State separation**: CONFIG for parameters, PALETTE for colors, globals for mutable state253- **Class-based entities**: Particles, agents, shapes as classes with `update()` + `display()` methods254- **Offscreen buffers**: `createGraphics()` for layered composition, trails, masks255 256### Step 4: Preview & Iterate257 258- Open HTML file directly in browser — no server needed for basic sketches259- For `loadImage()`/`loadFont()` from local files: use `scripts/serve.sh` or `python -m http.server`260- Chrome DevTools Performance tab to verify 60fps261- Test at target export resolution, not just the window size262- Adjust parameters until the visual matches the concept from Step 1263 264### Step 5: Export265 266| Format | Method | Command |267|--------|--------|---------|268| **PNG** | `saveCanvas('output', 'png')` in `keyPressed()` | Press 's' to save |269| **High-res PNG** | Puppeteer headless capture | `node scripts/export-frames.js sketch.html --width 3840 --height 2160 --frames 1` |270| **GIF** | `saveGif('output', 5)` — captures N seconds | Press 'g' to save |271| **Frame sequence** | `saveFrames('frame', 'png', 10, 30)` — 10s at 30fps | Then `ffmpeg -i frame-%04d.png -c:v libx264 output.mp4` |272| **MP4** | Puppeteer frame capture + ffmpeg | `bash scripts/render.sh sketch.html output.mp4 --duration 30 --fps 30` |273| **SVG** | `createCanvas(w, h, SVG)` with p5.js-svg | `save('output.svg')` |274 275### Step 6: Quality Verification276 277- **Does it match the vision?** Compare output to the creative concept. If it looks generic, go back to Step 1278- **Resolution check**: Is it sharp at the target display size? No aliasing artifacts?279- **Performance check**: Does it hold 60fps in browser? (30fps minimum for animations)280- **Color check**: Do the colors work together? Test on both light and dark monitors281- **Edge cases**: What happens at canvas edges? On resize? After running for 10 minutes?282 283## Critical Implementation Notes284 285### Performance — Disable FES First286 287The Friendly Error System (FES) adds up to 10x overhead. Disable it in every production sketch:288 289```javascript290p5.disableFriendlyErrors = true; // BEFORE setup()291 292function setup() {293 pixelDensity(1); // prevent 2x-4x overdraw on retina294 createCanvas(1920, 1080);295}296```297 298In hot loops (particles, pixel ops), use `Math.*` instead of p5 wrappers — measurably faster:299 300```javascript301// In draw() or update() hot paths:302let a = Math.sin(t); // not sin(t)303let r = Math.sqrt(dx*dx+dy*dy); // not dist() — or better: skip sqrt, compare magSq304let v = Math.random(); // not random() — when seed not needed305let m = Math.min(a, b); // not min(a, b)306```307 308Never `console.log()` inside `draw()`. Never manipulate DOM in `draw()`. See `references/troubleshooting.md` § Performance.309 310### Seeded Randomness — Always311 312Every generative sketch must be reproducible. Same seed, same output.313 314```javascript315function setup() {316 randomSeed(CONFIG.seed);317 noiseSeed(CONFIG.seed);318 // All random() and noise() calls now deterministic319}320```321 322Never use `Math.random()` for generative content — only for performance-critical non-visual code. Always `random()` for visual elements. If you need a random seed: `CONFIG.seed = floor(random(99999))`.323 324### Generative Art Platform Support (fxhash / Art Blocks)325 326For generative art platforms, replace p5's PRNG with the platform's deterministic random:327 328```javascript329// fxhash convention330const SEED = $fx.hash; // unique per mint331const rng = $fx.rand; // deterministic PRNG332$fx.features({ palette: 'warm', complexity: 'high' });333 334// In setup():335randomSeed(SEED); // for p5's noise()336noiseSeed(SEED);337 338// Replace random() with rng() for platform determinism339let x = rng() * width; // instead of random(width)340```341 342See `references/export-pipeline.md` § Platform Export.343 344### Color Mode — Use HSB345 346HSB (Hue, Saturation, Brightness) is dramatically easier to work with than RGB for generative art:347 348```javascript349colorMode(HSB, 360, 100, 100, 100);350// Now: fill(hue, sat, bri, alpha)351// Rotate hue: fill((baseHue + offset) % 360, 80, 90)352// Desaturate: fill(hue, sat * 0.3, bri)353// Darken: fill(hue, sat, bri * 0.5)354```355 356Never hardcode raw RGB values. Define a palette object, derive variations procedurally. See `references/color-systems.md`.357 358### Noise — Multi-Octave, Not Raw359 360Raw `noise(x, y)` looks like smooth blobs. Layer octaves for natural texture:361 362```javascript363function fbm(x, y, octaves = 4) {364 let val = 0, amp = 1, freq = 1, sum = 0;365 for (let i = 0; i < octaves; i++) {366 val += noise(x * freq, y * freq) * amp;367 sum += amp;368 amp *= 0.5;369 freq *= 2;370 }371 return val / sum;372}373```374 375For flowing organic forms, use **domain warping**: feed noise output back as noise input coordinates. See `references/visual-effects.md`.376 377### createGraphics() for Layers — Not Optional378 379Flat single-pass rendering looks flat. Use offscreen buffers for composition:380 381```javascript382let bgLayer, fgLayer, trailLayer;383function setup() {384 createCanvas(1920, 1080);385 bgLayer = createGraphics(width, height);386 fgLayer = createGraphics(width, height);387 trailLayer = createGraphics(width, height);388}389function draw() {390 renderBackground(bgLayer);391 renderTrails(trailLayer); // persistent, fading392 renderForeground(fgLayer); // cleared each frame393 image(bgLayer, 0, 0);394 image(trailLayer, 0, 0);395 image(fgLayer, 0, 0);396}397```398 399### Performance — Vectorize Where Possible400 401p5.js draw calls are expensive. For thousands of particles:402 403```javascript404// SLOW: individual shapes405for (let p of particles) {406 ellipse(p.x, p.y, p.size);407}408 409// FAST: single shape with beginShape()410beginShape(POINTS);411for (let p of particles) {412 vertex(p.x, p.y);413}414endShape();415 416// FASTEST: pixel buffer for massive counts417loadPixels();418for (let p of particles) {419 let idx = 4 * (floor(p.y) * width + floor(p.x));420 pixels[idx] = r; pixels[idx+1] = g; pixels[idx+2] = b; pixels[idx+3] = 255;421}422updatePixels();423```424 425See `references/troubleshooting.md` § Performance.426 427### Instance Mode for Multiple Sketches428 429Global mode pollutes `window`. For production, use instance mode:430 431```javascript432const sketch = (p) => {433 p.setup = function() {434 p.createCanvas(800, 800);435 };436 p.draw = function() {437 p.background(0);438 p.ellipse(p.mouseX, p.mouseY, 50);439 };440};441new p5(sketch, 'canvas-container');442```443 444Required when embedding multiple sketches on one page or integrating with frameworks.445 446### WebGL Mode Gotchas447 448- `createCanvas(w, h, WEBGL)` — origin is center, not top-left449- Y-axis is inverted (positive Y goes up in WEBGL, down in P2D)450- `translate(-width/2, -height/2)` to get P2D-like coordinates451- `push()`/`pop()` around every transform — matrix stack overflows silently452- `texture()` before `rect()`/`plane()` — not after453- Custom shaders: `createShader(vert, frag)` — test on multiple browsers454 455### Export — Key Bindings Convention456 457Every sketch should include these in `keyPressed()`:458 459```javascript460function keyPressed() {461 if (key === 's' || key === 'S') saveCanvas('output', 'png');462 if (key === 'g' || key === 'G') saveGif('output', 5);463 if (key === 'r' || key === 'R') { randomSeed(millis()); noiseSeed(millis()); }464 if (key === ' ') CONFIG.paused = !CONFIG.paused;465}466```467 468### Headless Video Export — Use noLoop()469 470For headless rendering via Puppeteer, the sketch **must** use `noLoop()` in setup. Without it, p5's draw loop runs freely while screenshots are slow — the sketch races ahead and you get skipped/duplicate frames.471 472```javascript473function setup() {474 createCanvas(1920, 1080);475 pixelDensity(1);476 noLoop(); // capture script controls frame advance477 window._p5Ready = true; // signal readiness to capture script478}479```480 481The bundled `scripts/export-frames.js` detects `_p5Ready` and calls `redraw()` once per capture for exact 1:1 frame correspondence. See `references/export-pipeline.md` § Deterministic Capture.482 483For multi-scene videos, use the per-clip architecture: one HTML per scene, render independently, stitch with `ffmpeg -f concat`. See `references/export-pipeline.md` § Per-Clip Architecture.484 485### Agent Workflow486 487When building p5.js sketches:488 4891. **Write the HTML file** — single self-contained file, all code inline4902. **Open in browser** — `open sketch.html` (macOS) or `xdg-open sketch.html` (Linux)4913. **Local assets** (fonts, images) require a server: `python -m http.server 8080` in the project directory, then open `http://localhost:8080/sketch.html`4924. **Export PNG/GIF** — add `keyPressed()` shortcuts as shown above, tell the user which key to press4935. **Headless export** — `node scripts/export-frames.js sketch.html --frames 300` for automated frame capture (sketch must use `noLoop()` + `_p5Ready`)4946. **MP4 rendering** — `bash scripts/render.sh sketch.html output.mp4 --duration 30`4957. **Iterative refinement** — edit the HTML file, user refreshes browser to see changes4968. **Load references on demand** — use `skill_view(name="p5js", file_path="references/...")` to load specific reference files as needed during implementation497 498## Performance Targets499 500| Metric | Target |501|--------|--------|502| Frame rate (interactive) | 60fps sustained |503| Frame rate (animated export) | 30fps minimum |504| Particle count (P2D shapes) | 5,000-10,000 at 60fps |505| Particle count (pixel buffer) | 50,000-100,000 at 60fps |506| Canvas resolution | Up to 3840x2160 (export), 1920x1080 (interactive) |507| File size (HTML) | < 100KB (excluding CDN libraries) |508| Load time | < 2s to first frame |509 510## References511 512| File | Contents |513|------|----------|514| `references/core-api.md` | Canvas setup, coordinate system, draw loop, `push()`/`pop()`, offscreen buffers, composition patterns, `pixelDensity()`, responsive design |515| `references/shapes-and-geometry.md` | 2D primitives, `beginShape()`/`endShape()`, Bezier/Catmull-Rom curves, `vertex()` systems, custom shapes, `p5.Vector`, signed distance fields, SVG path conversion |516| `references/visual-effects.md` | Noise (Perlin, fractal, domain warp, curl), flow fields, particle systems (physics, flocking, trails), pixel manipulation, texture generation (stipple, hatch, halftone), feedback loops, reaction-diffusion |517| `references/animation.md` | Frame-based animation, easing functions, `lerp()`/`map()`, spring physics, state machines, timeline sequencing, `millis()`-based timing, transition patterns |518| `references/typography.md` | `text()`, `loadFont()`, `textToPoints()`, kinetic typography, text masks, font metrics, responsive text sizing |519| `references/color-systems.md` | `colorMode()`, HSB/HSL/RGB, `lerpColor()`, `paletteLerp()`, procedural palettes, color harmony, `blendMode()`, gradient rendering, curated palette library |520| `references/webgl-and-3d.md` | WEBGL renderer, 3D primitives, camera, lighting, materials, custom geometry, GLSL shaders (`createShader()`, `createFilterShader()`), framebuffers, post-processing |521| `references/interaction.md` | Mouse events, keyboard state, touch input, DOM elements, `createSlider()`/`createButton()`, audio input (p5.sound FFT/amplitude), scroll-driven animation, responsive events |522| `references/export-pipeline.md` | `saveCanvas()`, `saveGif()`, `saveFrames()`, deterministic headless capture, ffmpeg frame-to-video, CCapture.js, SVG export, per-clip architecture, platform export (fxhash), video gotchas |523| `references/troubleshooting.md` | Performance profiling, per-pixel budgets, common mistakes, browser compatibility, WebGL debugging, font loading issues, pixel density traps, memory leaks, CORS |524| `templates/viewer.html` | Interactive viewer template: seed navigation (prev/next/random/jump), parameter sliders, download PNG, responsive canvas. Start from this for explorable generative art |525 526---527 528## Creative Divergence (use only when user requests experimental/creative/unique output)529 530If the user asks for creative, experimental, surprising, or unconventional output, select the strategy that best fits and reason through its steps BEFORE generating code.531 532- **Conceptual Blending** — when the user names two things to combine or wants hybrid aesthetics533- **SCAMPER** — when the user wants a twist on a known generative art pattern534- **Distance Association** — when the user gives a single concept and wants exploration ("make something about time")535 536### Conceptual Blending5371. Name two distinct visual systems (e.g., particle physics + handwriting)5382. Map correspondences (particles = ink drops, forces = pen pressure, fields = letterforms)5393. Blend selectively — keep mappings that produce interesting emergent visuals5404. Code the blend as a unified system, not two systems side-by-side541 542### SCAMPER Transformation543Take a known generative pattern (flow field, particle system, L-system, cellular automata) and systematically transform it:544- **Substitute**: replace circles with text characters, lines with gradients545- **Combine**: merge two patterns (flow field + voronoi)546- **Adapt**: apply a 2D pattern to a 3D projection547- **Modify**: exaggerate scale, warp the coordinate space548- **Purpose**: use a physics sim for typography, a sorting algorithm for color549- **Eliminate**: remove the grid, remove color, remove symmetry550- **Reverse**: run the simulation backward, invert the parameter space551 552### Distance Association5531. Anchor on the user's concept (e.g., "loneliness")5542. Generate associations at three distances:555 - Close (obvious): empty room, single figure, silence556 - Medium (interesting): one fish in a school swimming the wrong way, a phone with no notifications, the gap between subway cars557 - Far (abstract): prime numbers, asymptotic curves, the color of 3am5583. Develop the medium-distance associations — they're specific enough to visualize but unexpected enough to be interesting559 Discovery context
Discovered by repository scan. No exact path reference found in the snapshot’s root AGENTS.md.