Procedural Fish Swim
- Lab Skill
- v1.0.0
- Motion
A school of procedural fish rides a closed spline through an underwater scene — chain spines bend under per-joint angle constraints, fins and tail fan follow the total bend. Surrounding them: kelp sway, rising bubbles, drifting motes and god-ray shafts. One JSON sheet drives fish kinds, lanes, captions and palette.
範例 · 2
線上執行
在 SandBase sandbox 中執行 Procedural Fish Swim 的範例,並在此立即查看結果。
運作方式
- 01
Write the sheet
Describe the scene in one JSON sheet: size, frame rate, duration and seed, a closed Catmull-Rom loop of points in 0 to 1 frame coordinates, and the fish that ride it. Each fish has a kind (stream, reef, eel or koi), scale, lane, speed and palette. Add counts for motes, bubbles, weeds, rocks and light shafts, plus captions. kelp-reef-en.json is a bundled 30 s reef example.
- 02
Build and preview stills
Run npm install with Node 22 or newer, then node scripts/build.mjs sheet.json --out build. The build validates the sheet and writes a self-contained index.html with vendored GSAP and inlined fonts that needs no network. node scripts/stills.mjs --build build --at 2,5,9 writes a contact sheet in headless Chrome, which is much faster than rendering the full film.
- 03
Render and verify the film
node scripts/render.mjs --build build --out film.mp4 renders a silent H.264 film through HyperFrames, then checks the codec, the size against the manifest, the duration within 0.25 s and a full decode, and writes a JSON report. The film is deterministic, so the same sheet renders identical frames again. Everything is drawn procedurally; the Skill calls no model.
常見問題
How do the fish in Procedural Fish Swim move?
Each fish in Procedural Fish Swim is a 12-joint chain spine pulled along the loop. The head rides the spline, and every joint behind it sits a fixed arc length back with a lateral wave that grows toward the tail, so the swim wave travels from head to tail. Fins rotate with the local spine angle, and the tail fan widens with the total bend.
Is Procedural Fish Swim a physics simulation?
No. Procedural Fish Swim moves its fish kinematically: the chain is rebuilt from the loop position on every frame, with no muscle model and no water resistance. It is a 2D side view with no perspective or true 3D. Because each frame depends only on its time, backward seeks replay exactly and the film is reproducible.
Which fish can Procedural Fish Swim draw?
Procedural Fish Swim has four body plans, stream, reef, eel and koi, which set the joint count, width profile and fin size. Each fish takes its own body, belly and fin colours, an optional stripes, spots or koi pattern that bends with the spine, a plumpness from 0.5 to 2 and its own weave amplitude and frequency.
Why does a fish body pucker in Procedural Fish Swim?
A very tight loop makes the body pucker. Procedural Fish Swim keeps each fish on its spline, so sharp hairpins bend the spine more than its joints can follow smoothly. Smooth out the loop by spacing its control points more evenly, or lower that fish's speed, until no kink shows in the stills.
What output does Procedural Fish Swim produce?
Procedural Fish Swim produces build/index.html with manifest.json, a self-contained page with no network use, and film.mp4, a silent H.264 film at the sheet's frame rate and size. The sheet accepts even sizes from 320 to 3840 pixels, 12 to 60 fps and durations from 3 to 300 seconds, with English or Chinese captions.
Does Procedural Fish Swim have sound?
No. Procedural Fish Swim is silent by design and renders no music, narration or effects. Add your own score in an editor after rendering. The Skill draws every fish, plant and light shaft procedurally from the sheet, and it copies no third-party code, fonts or footage into the film beyond its licensed bundled fonts and GSAP.
更多 Skills
所有 Motion Skills →
Image Blaster
Turn one frozen moment into a camera-orbit concept video.

Sketchbook Film
Bring photographed sketchbook drawings to life as a short film with cut-out characters, ink lettering and a score.

SVG Paint Stages
Show a picture being painted: construction marks, contours, flat colour and finer patches, as a layered SVG and a short film.

Network Tally
Tell a growth story with real numbers: one node network grows with each counter, flashes, dims behind a spike chart and closes on an end card.

Radiograph Reel: Bumble Ledger
A specimen film reel: procedural bees, flowers and a wax comb glow as X-ray density, print in five switchable film styles with tracking labels, and a swarm morphs between formations.

Festival Grid Slides
Invite people to a fair, open day or club season, or pitch one, in a bright festival deck: whole-page colour fields with a fine dot grid, heavy slanted headlines, cream cards and tickets, round pictures, and suns, rosettes, rings, bunting and sprinkles.

