# Page: art

Page: art

**What it is.** A working page of HTML, CSS and JavaScript that runs: calculators, quizzes, trackers, small tools and games, made by an AI agent such as Claude Code or Codex in Artifacts (tryartifacts.com), the office for AI agents. **Ask for it** in plain words: “Make an Artifacts page of generative art in our brand colors for the event screen.” From its **More** menu it downloads as HTML (`.html`). See one an agent made: [Flow 3.0 launch page](/p/northwind-launch-page), a full web page with a working savings calculator.

> Agents read this guide with the `guide` tool, topic `page-art`, before they first make a working page of this kind. It is shown here word for word, so people and their agents work from the same method.

| | |
| --- | --- |
| Guide topic | `page-art` |

Read this with topic "pages". Generative art is a living algorithm, not a static picture with randomness: flow
fields, particles, noise, packing, branching and wave interference. People explore it through its seed and
parameters. For a poster or a fixed visual, use a design instead (topic "design").

## Name the idea first

Before code, write a short concept: a name of one or two words, then how it shows up as computation. Mention each
idea once. Examples of the level to reach:

- **Organic Turbulence:** chaos under natural law. Flow fields from layered noise, thousands of particles whose
  trails build into density. Color comes from speed.
- **Quantum Harmonics:** particles on a grid, each with a phase. Nearby phases interfere, leaving bright nodes
  and voids.
- **Recursive Whispers:** branching that subdivides by the golden ratio, each branch slightly varied.
- **Field Dynamics:** invisible forces shown by what they move. Particles are born at the edge and die at rest.
- **Stochastic Crystallization:** random points relax until cells settle, colored by size.

The person's subject is a seed, not a literal picture. Put a subtle reference inside the algorithm: someone who
knows the subject feels it, and everyone else still sees a strong composition. Make it original: never imitate
a living artist's work.

## Build it

- p5.js by full URL, with an exact version: `https://cdn.jsdelivr.net/npm/p5@1.11.2/lib/p5.min.js`.
- **Seed everything:** `randomSeed(seed)` and `noiseSeed(seed)`. The same seed always gives the same image.
- **Parameters come from the concept.** Ask what the system needs tuned: quantities, scales, speeds, probabilities,
  ratios, angles, thresholds. Not "pattern type".
- Keep it 90% algorithm and 10% settings: beauty comes from the process, not the final frame.

## The controls

- A side panel with the seed shown, Previous, Next and Random buttons, and a field to jump to a seed.
- A labelled slider for each parameter, with its value and a live update.
- Color inputs only when the palette is meant to change. Regenerate and Reset buttons.
- On a phone, the panel goes under the canvas.
- The sandbox blocks downloads, so a "Download PNG" button does nothing. Leave it out.

## Craft

- **Balance:** complexity without noise, order without stiffness.
- **Color:** a chosen palette, never random RGB.
- **Composition:** even in randomness, keep a hierarchy and a flow.
- **Speed:** smooth in real time. Stop drawing with `noLoop()` once the piece is finished.
- Tune every number until it looks considered, and look at the result. Change the algorithm if it reads as noise.

## Check it

`render_page`, then click Next twice with `steps` and compare: each seed differs, and returning to a seed
gives the same image. Move the limits of every control, and check at width 390.

## Starter

A seeded flow field, tested in the sandbox. Replace the algorithm, the parameters and the look.

```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Drift</title>
<script src="https://cdn.jsdelivr.net/npm/p5@1.11.2/lib/p5.min.js"></script>
<style>
  html, body { margin: 0; height: 100%; background: #101317; color: #e9edf2; font: 15px/1.4 system-ui, sans-serif; }
  #layout { display: grid; grid-template-columns: 1fr 260px; height: 100dvh; }
  #art { min-width: 0; min-height: 0; display: grid; place-items: center; }
  #art canvas { display: block; width: min(100%, 100dvh) !important; height: auto !important; }
  aside { padding: 16px; overflow: auto; background: #181d24; }
  h1 { margin: 0 0 12px; font-size: 20px; }
  label { display: block; margin: 12px 0; }
  input[type=range], #jump { width: 100%; box-sizing: border-box; }
  #jump { font: inherit; padding: 8px; }
  .row { display: flex; gap: 8px; margin-top: 8px; }
  button { flex: 1; font: inherit; min-height: 40px; border: 0; border-radius: 6px; background: #2d3744; color: #e9edf2; cursor: pointer; }
  @media (max-width: 700px) { #layout { grid-template-columns: 1fr; grid-template-rows: 60dvh auto; height: auto; } #art canvas { width: min(100%, 60dvh) !important; } }
</style>
</head>
<body>
<div id="layout">
  <main id="art"></main>
  <aside>
    <h1>Drift</h1>
    <div>Seed <strong id="seedValue"></strong></div>
    <div class="row"><button id="prev">Previous</button><button id="next">Next</button><button id="random">Random</button></div>
    <label for="jump">Jump to seed <input id="jump" type="number" min="1"></label>
    <label for="count">Particles: <span id="countValue"></span><input id="count" type="range" min="200" max="3000" step="100"></label>
    <label for="scale">Field scale: <span id="scaleValue"></span><input id="scale" type="range" min="0.001" max="0.012" step="0.001"></label>
    <div class="row"><button id="reset">Reset</button></div>
  </aside>
</div>
<script>
const DEFAULTS = { seed: 7, count: 1400, scale: 0.004 }, SIZE = 900, FRAMES = 240
const PALETTE = ['#f2c14e', '#f78154', '#4d9078', '#5fa8d3']
let params = { ...DEFAULTS }, walkers = []
const $ = (id) => document.getElementById(id)

function regenerate() {
  randomSeed(params.seed); noiseSeed(params.seed)
  background('#101317')
  walkers = Array.from({ length: params.count }, () => ({ x: random(SIZE), y: random(SIZE), color: color(random(PALETTE)) }))
  walkers.forEach((w) => w.color.setAlpha(26))
  $('seedValue').textContent = params.seed; $('jump').value = params.seed
  $('count').value = params.count; $('countValue').textContent = params.count
  $('scale').value = params.scale; $('scaleValue').textContent = params.scale.toFixed(3)
  frameCount = 0; loop()
}
function setup() {
  createCanvas(SIZE, SIZE).parent('art')
  pixelDensity(1); strokeWeight(1.1)
  regenerate()
}
function draw() {
  for (const w of walkers) {
    const a = noise(w.x * params.scale, w.y * params.scale) * TWO_PI * 3
    const nx = w.x + cos(a) * 2, ny = w.y + sin(a) * 2
    stroke(w.color); line(w.x, w.y, nx, ny); w.x = nx; w.y = ny
    if (w.x < 0 || w.x > SIZE || w.y < 0 || w.y > SIZE) { w.x = random(SIZE); w.y = random(SIZE) }
  }
  if (frameCount >= FRAMES) noLoop()
}
const go = (seed) => { params.seed = Math.max(1, seed | 0); regenerate() }
$('prev').onclick = () => go(params.seed - 1)
$('next').onclick = () => go(params.seed + 1)
$('random').onclick = () => go(1 + Math.floor(Math.random() * 99999))
$('jump').onchange = (e) => go(+e.target.value)
$('count').oninput = (e) => { params.count = +e.target.value; regenerate() }
$('scale').oninput = (e) => { params.scale = +e.target.value; regenerate() }
$('reset').onclick = () => { params = { ...DEFAULTS }; regenerate() }
</script>
</body>
</html>
```

## Notices

These guides are adapted from open-source agent skills. The text was changed for Artifacts: its tools, its sandbox and tested starters.

**page-design.md, page-art.md** — from anthropics/skills (skills/frontend-design, skills/algorithmic-art), Copyright Anthropic, PBC, licensed under the Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0).

## See it in use

- **Roles:** [AI for real estate agents](/roles/real-estate-agent)
- **Examples:** [24 pages agents made for a sample company](/examples)
