This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
A collection of standalone single-file HTML canvas art experiments that render real-time animations using Unicode/ASCII characters instead of pixels. Each file is self-contained with zero dependencies and opens directly in a browser.
Open any .html file directly in a browser — no server, build step, or tooling required.
Every experiment follows the same structure:
Rendering pipeline:
- A
<canvas id="c">fills the viewport; the cursor is hidden and replaced by a custom Unicode glyph drawn on canvas - A
CELLconstant (8–13px) drives the monospace grid:cols = floor(W / (CELL * ~0.58)),rows = floor(H / CELL) - Mouse position is normalized to
[0,1]asmx/my; a smoothed copy (pmx/pmy) follows with lerp ~0.06–0.08 resize()reallocates allFloat32Arraybuffers and resetsctx.fontframe()runs viarequestAnimationFrame; increments a globalttimer each tick- The grid is cleared each frame with a solid background fill, then characters are drawn cell-by-cell
Character selection:
- Characters are selected from curated Unicode sets by a normalized
[0,1]intensity/density value - Zalgo-style stacking uses Unicode combining marks: ABOVE (
\u0300–\u0311), BELOW (\u0323–\u0348), and OVERLAY/STRIKE (\u0334–\u0336) appended directly to base characters — the number of marks added scales with intensity - Character sets are layered by density tier (e.g. DUST → THREAD → WEAVE → NODES at increasing density)
Color computation:
- Colors are computed per-cell as inline
rgb(r,g,b)strings — no pre-built palettes exceptfractal.htmlwhich uses hard-stepped neonPAL[]arrays zalgo_vortex.htmldoes full inline HSL→RGB conversion using the CSS algorithm (theff/kk/aapattern)- Mouse proximity typically adds a brightness boost within a radius of ~0.06 normalized units
Simulation algorithms per file:
| File | Algorithm |
|---|---|
zalgo_vortex.html / zalgo_vortex (1).html |
Energy field from multiple orbiting vortices + sinusoidal noise; click spawns new vortices (max 5) |
fractal.html |
Burning Ship fractal with gravitational lens distortion near mouse, glitch tear lines, click shockwave |
dejong_organism.html |
De Jong strange attractor — runs 18k+4k iterations/frame, accumulates to grid[] + colorGrid[], both decay each frame |
mycelium_network.html |
Agent-based hyphal growth: stigmergy (trail following), branching, fusion at dense nodes, chemotaxis toward mouse; Web Audio synthesis driven by trail density |
physarum_zalgo.html |
Physarum polycephalum (slime mold): 4000 agents sense pheromone left/center/right, deposit + diffuse + decay each frame; Web Audio synthesis |
physarum_zalgo_grainfield.html |
Physarum variant with granular audio: loads .ogg sample files, routes density tiers (dust/thread/node/shard) to separate GainNode buses through a shared reverb/delay space |
reaction_diffusion.html |
Gray–Scott reaction-diffusion on two chemical fields a/b; box-drawing characters selected by gradient direction |
charsort.html |
Pixel-sort-style effect: brightness field sorted column-wise each frame, sorted output mapped through a density ramp with Zalgo stacking |
fibonacci_sphere.html |
1700 points distributed on a sphere via golden angle; projected to grid, accumulates energy/depthField/hueField; click sends radial pulses |
my-heart-is-a-hexadecimal-code-waiting-to-be-corrupted.html |
Heart curve (implicit p³ - x²y³ ≤ 0) with progressive corruption stages; hex digits + Zalgo marks; poem lines render in a beat-synced overlay; Web Audio synthesis |
the-line-v3.html |
Scrollable timeline of 16 communication eras (cave → live-code); each era has a character set, color, and body copy in a fixed HTML sidebar panel; canvas background shifts with current era |
the-line-v4.html |
Timeline piece with persistence map (Float32Array): cells stay bright after the mouse cursor passes; scrollY drives era transitions via wheel/touch |
dummy_os.html |
Fake terminal OS with floating windows (process list, filesystem tree, log stream, memory map); no simulation state — all output is procedurally generated text |
index.html |
Gallery landing page listing all experiments with links; not a canvas experiment |
Interaction model (consistent across all files):
mousemove/touchmove— updatesmx/myclick— simulation-specific injection (new vortex / pheromone burst / attractor noise burst / spore drop)- Some files also handle
wheelfor additional effects
- All grid data uses
Float32Arrayfor performance (energy, pheromone, trail, age, color channels, agent positions/headings) - Physarum agents use three separate typed arrays
ax,ay,ah(SoA layout) for N=4000 agents dejong_organism.htmlruns a second attractor with slightly perturbed params each frame for texture varietymycelium_network.htmlcaps total hyphae at 2000 and respawns near mouse at low probability each frame; hyphae carrygendepth (max 8) to limit branch explosionfractal.htmluses atears[]array for glitch horizontal displacement lines; tears spawn randomly each frame and decay over ~8–15 ticks
Web Audio pattern (physarum_zalgo_grainfield, mycelium_network, physarum_zalgo, hex heart):
AudioContextis created on first user gesture to satisfy autoplay policy; all synthesis gated behindaudioReadyflag- Multiple
GainNodebuses correspond to visual density tiers; a shared reverb convolver + feedback delay sits at the master output physarum_zalgo_grainfield.htmlloads external.oggsample files viafetch+decodeAudioData; sample paths are declared as aSAMPLE_PATHSobject at the top of the script
HTML overlay panels (the-line-v3, the-line-v4):
- Some pieces mix a canvas background with fixed-position HTML panels (sidebar reader, bottom player dock, autoplay prompt)
- The
--accentCSS custom property is updated from JS each frame to tint all overlay UI to match the current era's color - These files are not pure-canvas; DOM manipulation runs alongside
requestAnimationFrame
renders/ directory:
- Contains pre-recorded
.mp4exports of each experiment (story format, 10–20 s) used for social sharing; not part of the browser experiments themselves