Creating algorithmic, generative art using p5.js with seeded randomness and interactive parameter exploration.
You generate algorithmic philosophies - computational aesthetic movements that you then EXPRESS THROUGH CODE. You output .md files (philosophy), .html files (interactive viewer), and .js files (generative algorithms).
You do this in two steps:
Here is the task you should undertake first:
You are NOT creating static images or templates. You are creating an ALGORITHMIC PHILOSOPHY that the next Claude will interpret through:
Think of it like:
Your philosophy must emphasize: Algorithmic expression. Emergent behavior. Computational beauty. Seeded variation.
Name the movement (1-2 words): "Organic Turbulence" / "Quantum Harmonics" / "Emergent Stillness"
Articulate the philosophy (4-6 paragraphs - concise but complete):
What is the ALGORITHMIC essence? How does this philosophy express itself through:
CRITICAL GUIDELINES:
Your philosophy must guide the next version of you to express ideas ALGORITHMICALLY, not through static images. Beauty lives in the process, not the final frame.
"Organic Turbulence" Philosophy: Chaos constrained by natural law, order emerging from disorder. Algorithmic expression: Flow fields driven by layered Perlin noise. Thousands of particles following vector forces, their trails accumulating into organic density maps. Multiple noise octaves create turbulent regions and calm zones. Color emerges from velocity and density - fast particles burn bright, slow ones fade to shadow. The algorithm runs until equilibrium - a meticulously tuned balance where every parameter was refined through countless iterations by a master of computational aesthetics.
"Quantum Harmonics" Philosophy: Discrete entities exhibiting wave-like interference patterns. Algorithmic expression: Particles initialized on a grid, each carrying a phase value that evolves through sine waves. When particles are near, their phases interfere - constructive interference creates bright nodes, destructive creates voids. Simple harmonic motion generates complex emergent mandalas. The result of painstaking frequency calibration where every ratio was carefully chosen to produce resonant beauty.
"Recursive Whispers" Philosophy: Self-similarity across scales, infinite depth in finite space. Algorithmic expression: Branching structures that subdivide recursively. Each branch slightly randomized but constrained by golden ratios. L-systems or recursive subdivision generate tree-like forms that feel both mathematical and organic. Subtle noise perturbations break perfect symmetry. Line weights diminish with each recursion level. Every branching angle the product of deep mathematical exploration.
"Field Dynamics" Philosophy: Invisible forces made visible through their effects on matter. Algorithmic expression: Vector fields constructed from mathematical functions or noise. Particles born at edges, flowing along field lines, dying when they reach equilibrium or boundaries. Multiple fields can attract, repel, or rotate particles. The visualization shows only the traces - ghost-like evidence of invisible forces. A computational dance meticulously choreographed through force balance.
"Stochastic Crystallization" Philosophy: Random processes crystallizing into ordered structures. Algorithmic expression: Randomized circle packing or Voronoi tessellation. Start with random points, let them evolve through relaxation algorithms. Cells push apart until equilibrium. Color based on cell size, neighbor count, or distance from center. The organic tiling that emerges feels both random and inevitable. Every seed produces unique crystalline beauty - the mark of a master-level generative algorithm.
These are condensed examples. Your actual algorithmic philosophy should be 4-6 substantial paragraphs.
The algorithmic philosophy should be 4-6 paragraphs long. Full of poetic computational philosophy that brings together what you're going for. Avoid repeating the same points. You should output this algorithmic philosophy as a .md file.
CRITICAL STEP: Before implementing the algorithm, identify the subtle conceptual thread from the user's original request.
THE ESSENTIAL PRINCIPLE: The concept is a subtle, niche reference embedded within the algorithm itself - not always literal, always sophisticated. Someone familiar with the subject should feel it intuitively, while others simply experience a masterful generative composition. The algorithmic philosophy provides the computational language. The deduced concept provides the soul - the quiet conceptual DNA woven invisibly into parameters, behaviors, and emergence patterns.
This is VERY IMPORTANT: The reference must be so refined that it enhances the work's depth without announcing itself. Think like a jazz musician quoting another song through algorithmic harmony - only those who know will catch it, but everyone appreciates the generative beauty.
Now that you have the philosophy AND the conceptual framework, you must express it through code. Take a second to gather your thoughts. Clear your mind. Only use the algorithmic philosophy you created and the instructions below.
CRITICAL: BEFORE writing any HTML, you MUST:
templates/viewer.htmlDO NOT:
DO:
The template is your foundation. Build on it, don't rebuild it.
Create your generative art as if it were gallery-quality, using the algorithmic philosophy. This is computational art that lives and breathes.
Seeded Randomness (Art Blocks Pattern):
// ALWAYS use a seed for reproducibility
let seed = 12345; // or hash from user input
randomSeed(seed);
noiseSeed(seed);
Parameter Structure - FOLLOW YOUR PHILOSOPHY:
Your parameters should emerge naturally from your algorithmic philosophy.
Ask yourself: "What qualities of this system can be adjusted?"
let params = {
seed: 12345, // Always include seed for reproducibility
colorPalette: ['#d97757', '#6a9bcc', '#788c5d', '#b0aea5'], // Anthropic colors
// Add parameters that control YOUR algorithm:
// - Quantities (how many?)
// - Scales (how big? how fast?)
// - Probabilities (how likely?)
// - Ratios (what proportions?)
// - Angles (what direction?)
// - Thresholds (when does behavior change?)
};
Don't think in terms of "pattern types" - think in terms of the properties your system needs to be tunable.
Core Algorithm - EXPRESS YOUR PHILOSOPHY:
CRITICAL: Your algorithmic philosophy should dictate what you build.
Don't think "which pattern should I use?" - think "how do I express this philosophy through code?"
If your philosophy is about organic emergence, you might use:
If your philosophy is about mathematical beauty, you might use:
If your philosophy is about controlled chaos, you might use:
The algorithm flows from the philosophy, not from a menu of options.
Let the conceptual essence guide your implementation. Be creative. Be original. Build something that expresses YOUR vision for this particular request.
Canvas Setup: Standard p5.js structure:
function setup() {
createCanvas(1200, 1200);
// Initialize your system
}
function draw() {
// Your generative algorithm
// Can be static (noLoop) or animated
}
CRITICAL: Make it feel like a master generative artist created this algorithm through countless iterations. Every parameter should feel carefully tuned. Every pattern should emerge with purpose. This is NOT random noise - this is CONTROLLED CHAOS refined through deep expertise.
You must output:
templates/viewer.html (see STEP 0 and next section)The HTML artifact contains everything: p5.js (from CDN), your algorithm, parameter controls, and UI - all in one file that works immediately in claude.ai artifacts or any browser. Start from the template file, not from scratch.
REMINDER: You should have already read templates/viewer.html (see STEP 0). Use that file as your starting point.
Create a single, self-contained HTML artifact that allows exploration of your generative art. This artifact should work immediately in claude.ai or any browser - no setup required. Everything must be embedded inline.
The templates/viewer.html file is your foundation. It contains the exact structure and styling you need.
FIXED (always include exactly as shown):
VARIABLE (customize for each artwork):
Every artwork should have unique parameters and algorithm! The fixed parts provide consistent UX - everything else expresses your unique vision.
1. Parameter Controls
2. Seed Navigation
3. UI Layout
┌────────────────────────────────────┐
│ [Canvas - p5.js generative art] │
│ │
│ │
└────────────────────────────────────┘
┌────────────────────────────────────┐
│ Seed: [123] [Prev] [Next] [Random]│
│ │
│ Particle Count: [slider] 5000 │
│ Noise Scale: [slider] 0.01 │
│ Flow Speed: [slider] 0.5 │
│ [Color pickers for palette...] │
│ │
│ [Reset Parameters] [Download PNG] │
└────────────────────────────────────┘
4. Single Artifact Structure
<!DOCTYPE html>
<html>
<head>
<!-- p5.js from CDN - always available -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.7.0/p5.min.js"></script>
<style>
/* All styling inline - clean, minimal */
/* Canvas on top, controls below */
</style>
</head>
<body>
<div id="canvas-container"></div>
<div id="controls">
<!-- All parameter controls -->
</div>
<script>
// ALL p5.js code inline here
// Parameter objects, classes, functions
// setup() and draw()
// UI handlers
// Everything self-contained
</script>
</body>
</html>
CRITICAL: This is a single artifact. No external files, no imports (except p5.js CDN). Everything inline.
5. Implementation Details - BUILD YOUR SIDEBAR
The sidebar structure:
1. Seed (FIXED) - Always include exactly as shown:
2. Parameters (VARIABLE) - Create controls for YOUR art:
<div class="control-group">
<label>Your Parameter Name</label>
<input type="range" id="yourParam" min="..." max="..." step="..." value="..." oninput="updateParam('yourParam', this.value)">
<span class="value-display" id="yourParam-value">...</span>
</div>
Add as many control-group divs as you have parameters.
3. Colors (OPTIONAL/VARIABLE) - Include if your art needs adjustable colors:
4. Actions (FIXED) - Always include exactly as shown:
Requirements:
The HTML artifact works immediately:
The artifact includes seed navigation by default (prev/next/random buttons), allowing users to explore variations without creating multiple files. If the user wants specific variations highlighted:
This is like creating a series of prints from the same plate - the algorithm is consistent, but each seed reveals different facets of its potential. The interactive nature means users discover their own favorites by exploring the seed space.
User request → Your algorithmic philosophy → Your implementation
Each request is unique. Your job is to:
The constants:
Everything else is variable:
Trust your creativity. Let the philosophy guide the implementation.
This skill includes helpful templates and documentation:
templates/viewer.html: REQUIRED STARTING POINT for all HTML artifacts.
templates/generator_template.js: Reference for p5.js best practices and code structure principles.
README.md: Overview documentation explaining the skill structure and concepts.
Critical reminder: