/wiggle-that-diagram:wiggle-that-diagramfrom wiggle-that-diagram
Use when someone asks to animate an illustration in an HTML slide deck or HTML report, show how a mechanism, workflow or data flow works step by step, make an explainer animation for a slide, slow an animation down because it is too fast to read, add captions to one, or offer three animation styles to pick from. Builds one captioned, looping, self-contained file per mechanism that drops into an iframe srcdoc (step rail, reduced motion, deck-safe input forwarding), in three formats: A diagram clip (huashu engine, text-free video + HTML labels), B whiteboard (huashu y3), C live SVG + GSAP with a virtual camera. Also style D: a 1-3 minute silent promo or explainer film with words on screen, rendered to MP4 from one SVG page (a kit of shapes, one idea per shape), including a real-client cut and a public cut from one file. Use for "make a promo video", "an explainer film", "a video for the team".
Ships in wiggle-that-diagram. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turn one static "how it works" illustration into a short, captioned, looping animation that sits inside an
HTML deck or report, and offer it in three formats so the reader can pick. The method was worked out on a
real client deck (see "Worked example"). It uses huashu-art-motion for direction (shot lists,
camera rules, the six ways to fail) and, for styles A and B, as the rendering engine.
Asked for a film, not a slide animation (a 1–3 minute promo or explainer, silent, words on screen, an MP4)?
Go to "Style D: a long film" below and references/long-film.md; the rest of this file is about loops in a deck.
Use it when:
a deck or HTML report has a mechanism diagram (files flow, rules check, a person approves) and the reader should see it happen, step by step, with words they can read;
the user wants options in genuinely different formats, not three colour schemes of one;
an earlier animation was "too fast to read" or needs captions.
someone wants a 1–3 minute silent promo or explainer film with words on screen (style D).
Do not use it for: a single micro-interaction (use animate), a narrated video with voice-over (use
huashu-art-motion directly), or a chart of numbers (use dataviz).
| A · diagram clip | B · whiteboard | C · live SVG | |
|---|---|---|---|
| Picture | huashu engine canvas scene, t1_3b1b grammar, rendered to a text-free H.264 | huashu y3_whiteboard grammar, dark board, pen draws and hand-letters (Kalam), square video | Inline SVG world filmed by a virtual camera (viewBox tweened by GSAP 3.12.5) |
| Words on the picture | HTML labels placed over the video from a dumped camera track (always sharp) | Drawn into the video (must be big enough for a phone) | Real SVG text (sharp, reflows by changing camera frames per width) |
| Size per film (worked example) | 360–820 KB (budget 900 KB) | 847–886 KB (budget 900 KB) | 21–34 KB (budget 40 KB) |
| Feels like | a clean 3Blue1Brown-style diagram | someone explaining at a whiteboard | a polished product animation |
| Main risk | labels drift if the scene changes without re-rendering | tight size budget; phone labels 12–14 px | fiddly camera maths; GSAP transform quirks |
All three share ONE caption script, the same beats and the same embed contract, so a style switcher shows the same story told three ways.
Each step ends with the check that proves it is done.
Find the mechanism and one concrete example. Read the host page (read only). Pick the moment to show and ONE real example threaded through every beat (one row, one record, one case, with its real values). List what must not be invented (ids, figures, imagery). → Check: you can say each beat as "this object does this", with a noun and a verb.
Write the caption script first. One caption sentence per beat, 3–6 beats per film, in
beats.json (format: scripts/common/beats.example.json). Captions are identical in every style. Then run
the pacing gate and read the floor it prints:
python3 ~/.claude/skills/wiggle-that-diagram/scripts/common/pace_check.py beats.json
→ Check: every beat OK, and the user has agreed the resulting loop lengths (or shorter captions). Never set a loop target separately from the captions; see "Pacing".
Write the brief. Fill references/brief-template.md into SPEC.md: feedback quoted, tokens, pacing rule,
caption script, beats, embed contract with the verbatim snippet, budgets, deliverables. → Check: an agent with
no other context could build from it.
Directions round (optional, when the user has not seen the styles). Three agents in parallel, one per style, each prototyping the SAME moment of one film (~8–12 s) and shooting stills at 1280 and 390 px. Show the stills side by side; the user picks one or keeps all three. → Check: the user's choice is in writing.
Build round. One agent per style (each continuing its own prototype), all films in that style, writing
only under <work>/<style>/final/. Briefs: references/agent-briefs.md. Say the agent count and tier to the
user before launching. → Check: each returns files, stills, NOTES.md and an honest open-issues list.
Build recipes (what each style agent actually did; scripts are in scripts/style-a|b|c/):
Two neutral films ship in all three styles, each as beats.json plus style-a/, style-b/, style-c/:
examples/pizza/ (5 beats, simple) and examples/expenses/ (6 beats: cards, colour-coded reasons, arrows to a
second and third panel). Start from the folder for your style.
cp -R ~/.claude/skills/huashu-art-motion/scripts/engine <A>/engine and touch <A>/engine/favicon.ico.
Add engine/ways/way_make.js (from scripts/style-a/), run beats_js.py beats.json --engine engine --var <VAR> (captions and timing from the shared script, never a hand copy), a scene file engine/ways/<film>.js
that calls WAY.make({poster, beats, camBase, cam, labels}) and registers SCENES['<film>'], and
engine/eras_<film>.js setting FILM_SIZE=[1280,720], PUNCH=0 (otherwise the engine adds a 0.03 punch-in on
transitions), SCENE_LIBS=['ways/way_make.js','ways/<film>_beats.js','ways/<film>.js'], SCENE_DIR='ways',
ERAS=[{id:'<film>',dur:1}]. Draw NO text on the canvas. The drawing helpers (rounded boxes, dots, lines,
fades, moves along a path) are written per film; examples/pizza/style-a/pizza.js has a small set to copy.
Then render_way.py <film> --scale 0.75 --crf 30 → build.py <film> --meta meta.json → pace_check.py work/<film>_data.json → test_embed.py final/<film>.html:<verdict beat> (or all at once: make.sh).
After any scene edit, re-render and run midmove.py at mid-move times: labels must sit on their objects.favicon.ico: under real Chrome its 404 counts as a page
error and render.py exits 1 after writing a good video) and patch render.py to
chromium.launch(channel='chrome', …). Put
kit.js in engine/demos/_hb/, write engine/demos/<film>/board.js (uses HB.make(), anchors events to
BEATS[k].t0 + offset) and engine/demos/<film>/eras.js (FILM_SIZE=[1080,1080], PUNCH=0, Kalam font face,
SCENE_LIBS=['demos/<film>/beats.js','demos/_hb/kit.js','demos/<film>/board.js']). Then
build_beats.py beats.json --engine engine → uv run --with playwright python engine/render.py --film demos/<film> --fps 30 --crf 12 --out work/<film>_master.mp4 → build_html.py <film> --beats beats.json
(720², 24 fps, lowest CRF that fits) → test_contract.py final/<film>.html --beats beats.json. Each film
ends with a pull-back to the whole board, a ≥ 1 s hold, then an eraser wipe; the empty board is where the loop restarts.
The last beat's still in beats.json is shared by every style and must land before the wipe starts, or the
poster and the reduced-motion frame show a half-erased board. Objects that move (a scooter, a box) are
K.custom items with handed: false whose position is a function of time; give each one an end time, or it
stays on the board after its job is done.examples/pizza/style-c/ (SVG, timeline, theme). Write
src/<film>.svg (one <svg id="scene" class="scene"> holding <g id="world">; tag every <text> or its group
with data-b="<beat>", 1-based, set to the beat in which the camera FIRST shows it) and src/<film>.js (camera
frames FR / ORDER, each frame with a w rect for wide screens and a t rect for narrow ones; reveals with
R(selector, beat, offset), moves with camTo(i, beat, offset), line draws with draw()). In the JS, beat is
0-based (B[0] is beat 1). R() is only for words, at offset ≥ 2.5 s: every R() call is logged as a word
reveal and the caption counts as words at offset 0, so R() on a wordless shape or at offset 0 fails the
spacing check. Shapes, movement and words that arrive with the caption use plain tl.to(…, T(beat, offset)).
Wrap any element that has its own transform in a parent <g> and animate the child. Then
build.py beats.json --src src --out final [--css theme.css] → test_contract.py final/<film>.html --stills <scratch>/stills → widthcheck.py. The runtime (shell.html, shell.css, head.js, tail.js) is reused as
is; to match the host page, put new :root tokens (--panel, --ink, --muted, --line, --gold,
--cap-ink, --on-gold, …) in a theme file and pass it with --css. For a README or chat picture of a film:
gif.py final/<film>.html --beat 4 --from 1.9 --to 8.6 --out film.gif (or --still <s> for a PNG).Check before showing anyone (all three builds skipped the last three; do them):
scripts/common/contact_sheet.py);film_gate.py on the A/B mp4s (with the ffprobe shim if needed), red read as explained in traps.md;references/embed-contract.md), on a real phone, and in
Safari (style A/B fallback: poster + numbered captions when H.264 cannot play).Hand over. Show the three styles side by side (stills or a switcher page), with the loop lengths, sizes, what was invented on the picture (for the user to confirm), and what was not checked.
A promo or explainer film: 10–20 shots, silent, a caption per shot, delivered as an MP4. The full method, with
the reason behind every rule, is references/long-film.md; the positive example is examples/loop-promo/film.html
(a 2-minute promo, read its source). In one paragraph each:
STR.public, STR.internal, chosen by ?v=). For a cut with a real client's
lines: verbatim, attributed and dated, an AI agent's words labelled as the agent's, your framing outside the quote
marks, invented figures labelled "example", a small tag per shot naming the run it came from.film_beats.js → fit_durs.py → pace_check.py), then render, gate, deliver.references/long-film.md; skip it when the
look is already chosen); after rendering and before delivering, reviewers chosen by who appears in the film
(step 9): a cold viewer and a fact checker always, plus a stand-in for any colleague whose work is
shown and for any client who is named, all from one review pack (every on-screen string as built, the sources,
frames pulled from the final MP4). On a data film the cold viewer and fact checker found nothing that had to
change, and the two stand-ins found five things. A film about someone's data shown in public has its own rules
(no actor in a challenge, copies "on purpose", no open question on screen, the client's hope in the client's own
words, names only by the owner's choice): see references/long-film.md.python3 <skill>/scripts/style-d/new_film.py my-film # kit.js, fonts/, a plumbing-only film.html
cd my-film
uv run --with playwright --with pillow python <skill>/scripts/style-d/render.py film.html --per-shot --out sheet-public
# -> sheet-public.png (one still per shot) + a list of labels the frame cuts; look at both, for every cut
node <skill>/scripts/style-d/film_beats.js film.html # beats.<cut>.json from what is drawn, + advisories
python3 <skill>/scripts/style-d/fit_durs.py beats.public.json # paste into DURS, then pace_check.py: ALL OK
uv run --with playwright python <skill>/scripts/style-d/render.py film.html --video film.mp4 --variant public
scripts/deck/)What the worked deck does, and what broke on the way:
<script type="text/plain" id="anim-{style}-{way}">
with </script → <\/script and <!-- → <\!-- escaped; JS decodes it into iframe.srcdoc only when the
slide is shown (one iframe, built on demand). embed_anims.py does this idempotently between
<!--ANIM-DATA-START--> / <!--ANIM-DATA-END--> markers, so re-running after a rebuild replaces only the data.
The deck grew from ~0.3 MB to 4.5 MB.aria-pressed), plus a "Watch it work" link inside each
Way's detail panel that sets the way, closes the panel and jumps to the slide.go() dispatches a deck:slide event; the switcher posts anim-play when
its slide becomes current (and on iframe load if current), anim-pause otherwise.onWheel(dy,mode),
onKey(key), onSwipe(dy,dx), called both by the deck's own listeners and by the iframe's forwarded
messages (accept only e.source === frame.contentWindow). howtest2.py proves one gesture = one slide.howFit in embed_anims.py): the srcdoc
iframe is same-origin, so the deck measures contentDocument.body height itself. It tries inner widths from the
box width down to 740 px (binary search, waiting ~90 ms per width because a film may set its layout in JS on
resize, frame hidden meanwhile) and keeps the widest that fits; only if 740 px is still too tall does it set
frame.style.zoom. Narrowing beats zooming because the caption keeps its size while the picture shrinks.
Traps met on the way: (a) zoom with width:100% widens the inner layout (1126 → 1876 px) and loops down to
the floor, so always pin frame.style.width in px; (b) documentElement.scrollHeight never reports less than
the iframe's current height, so it cannot drive shrinking (measure body instead, with the frame made tall);
(c) measuring in the same tick as the width change reads a stale JS layout. Ask films for a side-by-side layout
when wide (square pictures) and ≤ 580 px total height at 780 px wide. Phones (< 900 px) do not fit; the slide
scrolls, with a compact header.howtest.py (switching, deep link, arrows), howtest2.py (all 9 load and play in real Chrome,
wheel/key/swipe over the iframe move exactly one slide), plus the deck's own one-gesture-one-slide checks.
Any deck test that hard-codes slide numbers breaks when the slide is inserted: look slides up by id.The first prototypes were 8–13 s. The reader's verdict: too fast to read what was happening, and it needed captions. The rule used for the rebuild:
scripts/common/pace_check.py (and style C's build.py, which counts the same way from the SVG). Style A's own
pace_check.py checks the built film's real label times and differs in one way: a word repeated by a new label
in a later beat counts again there;Consequence to tell the user up front: captions of ~20 words per beat make 5–6 beat films of 40–80 s. In the
worked example the brief's 18–34 s targets were impossible (captions alone needed 31.5–51.7 s); all three
agents chose the reading rule and built 35–82 s loops, which nobody had confirmed with the user. Shorter loops
mean shorter captions, changed once in beats.json for all styles.
Count the picture words from what is drawn, not from a list kept by hand. On the style D film a hand list drifted
four times and every drift was a pacing failure found late; style-d/film_beats.js reads the rendered SVG instead,
and on its first run it found five shots 0.2–1.2 s short that the hand list had passed.
references/embed-contract.md)<iframe srcdoc>. Picture + caption strip +
step rail + Play/Pause, nothing else. Media base64-inline; only Google Fonts and pinned GSAP may load.{type:'anim-height', h} (h = root element height, so it can shrink); starts paused on beat 1's
finished frame; anim-play / anim-pause messages; autoplays only when opened on its own.deck-wheel / deck-key / deck-swipe with the
verbatim snippet, so one gesture still moves one slide.references/agent-briefs.md)Worked example: 3 Opus direction agents → user kept all three styles → 3 Opus build agents (one per style, each
continuing its own prototype) → 1 agent wrote this skill. Seven agents in total. Each brief carried: the shared
SPEC.md path, the huashu files to read, the style's format in one paragraph, the host page as read only, the
folder it may write to, channel='chrome' and the ffmpeg location, the self-check list, and a JSON result schema
that includes open_issues. Add next time: one independent reviewer, and a single orchestrator decision on any
conflict all agents raise (here: loop length).
references/traps.md)channel='chrome'.ffprobe was missing: put scripts/common/ffprobe-shim first on PATH for huashu's film_gate.py.render.py now stops instead); a camera pan at the end of a
shot crops the labels on the far side, so check the END still of every shot. A wiped-in caption shows half a
sentence on any still (setupFilm({capMode:'fade'})); a count-up caught mid-shot reads as the result (hold the
final counts ≥ 2 s); picture text under 26 px was called too small for a room. In a data film, a caption true of
the data but false of the picture on screen (a rider "finds no bike" beside parked bikes), and drawn things that do
not add up across shots (40 bikes leaving for 16 free docks), are what a cold viewer finds first: write the sums
into the film as a self-check that throws.Every script starts with a one-line comment saying what it does and its inputs; run a Python script with -h
(or no arguments) for usage. What was run after client content was stripped, against the worked example's output:
A build.py and C build.py rebuilt byte-identical files; B build_html.py rebuilt a same-size file; the A, B
and C contract tests passed on one film each (28, 34 and all checks); A render_way.py rendered stills; A
pace_check.py, midmove.py, B build_beats.py, C camdbg.py, widthcheck.py, common/* ran once each.
Not run: make.sh (syntax check only) and kit.js (syntax check only; it runs inside the engine).
On a new diagram (the neutral pizza example, 6 Nov 2026), every style end to end: common/pace_check.py; C
build.py --css, test_contract.py (all checks), widthcheck.py, gif.py; B build_beats.py, the engine render,
build_html.py, test_contract.py (32/32); A beats_js.py, make.sh (render, build, pace_check.py,
test_embed.py: no failures), midmove.py; huashu film_gate.py on both videos (pass, one yellow);
common/contact_sheet.py. Again on the expenses example (6 Nov 2026): C test_contract.py (all checks), B
test_contract.py (32/32), A make.sh (no failures) and midmove.py, film_gate.py (B pass, A yellow), and a
switcher page playing all six films in real Chrome at 1280 and 390 px.
| Script | Use |
|---|---|
common/pace_check.py | Pacing gate on beats.json; prints the shortest loop the captions allow |
common/beats.example.json | The shared beats format (neutral example) |
common/contact_sheet.py | Tile stills into one image to look at |
common/ffprobe-shim/ffprobe | Stand-in for a missing ffprobe (huashu film_gate) |
style-a/way_make.js, beats_js.py, render_way.py, build.py, pace_check.py, test_embed.py, midmove.py, make.sh, player_template.html | Style A pipeline: label track, captions from beats.json, render, inline, gates, contract test |
style-b/kit.js, build_beats.py, build_html.py, test_contract.py, player.html | Style B pipeline: board kit, timing bridge, encode + inline, contract test |
style-c/shell.html, shell.css, head.js, tail.js, build.py, test_contract.py, camdbg.py, widthcheck.py | Style C runtime, builder (--css theme), contract + timing test, camera and width checks |
style-c/gif.py | GIF of one beat (or a PNG still) from a built style C film, by seeking in real Chrome |
style-d/kit.js, film_skeleton.html, new_film.py, render.py, film_beats.js, fit_durs.py, fonts/ | Style D: the shape kit and film plumbing, a plumbing-only start, stills / per-shot sheet with a cut-label check / MP4 renderer (stops if the font is missing), word count from the drawn SVG, durations that pass the reading rule, Outfit (OFL) |
examples/loop-promo/film.html | Style D worked example: a 2-minute promo, 16 shots, public cut only |
examples/pizza/, examples/expenses/ | Two neutral films in all three styles to start from: beats.json, style-a/ (scene, eras, meta), style-b/ (board, eras), style-c/ (SVG, timeline, theme where used) |
deck/embed_anims.py, howtest.py, howtest2.py | Host side: embed all films + switcher slide + zoom-to-fit into a stacked-slide deck; tests (labels and anchor ids are the worked deck's, change first) |
Dependencies: uv, Google Chrome, ffmpeg (styles A, B and D), node (style D), Pillow for contact sheets, the
huashu-art-motion skill (engine for A and B, film_gate.py, storyboard_lint.py).
Built on a real client deck (details withheld): a deck comparing three alternative approaches to one process, each animated in all three styles (3 × 3 films). Everything above (timings, sizes, traps, heights) comes from that build. Keep your own worked example's files (spec, the films, each style's NOTES.md) somewhere lasting, outside any session scratchpad, and point to it from your project notes, not from this skill.
Two neutral examples ship with the skill. examples/pizza/ (an order going from a phone app to a kitchen
to a door, five beats, 42 s, in all three styles: A 423 KB, B 513 KB, C 21 KB) was the first test of these instructions on a diagram other
than the client deck. examples/expenses/ (an expense claim checked against written rules, colour-coded, approved and
paid; six beats, 46 s: A 435 KB, B 818 KB, C 23 KB) is the richer one, closer to a real mechanism slide. What they got
wrong is fixed above and listed in references/traps.md ("Learned on the pizza example", "Learned on the expenses
example").
THIRD_PARTY_NOTICES.md.scripts/style-d/fonts/ with its licence, so a film never renders in a fallback font.units()), honest proportions. The hero must act in every shot it is in. One shape per
kind of quantity. The palette is swappable (window.KIT_THEME, now also setting the page background; light-ground
keys documented). film_beats.js now counts each number left on screen as its own word (two side by side were
one). Safe area under a camera push, mid-shot stills for motion shots, and a rule that a cold-test subject must
not be named in the skill.long-film.md gains step 0 (three directions on the same two shots), reviewers chosen by who appears in
the film (step 9, with a frame-pull script), a section on showing someone's data in public, six data-story shapes
to draw (no new kit functions), a 26 px floor for stage labels and five traps. The film skeleton now starts with
capMode:'fade'. kit.js: setupFilm({capMode:'fade'}) fades captions in whole. render.py asks for both Outfit
weights before its font check, so a film whose first frame has no text no longer fails it (a missing font file
still stops the run with the same message).kit.js: tape, dial, sticky note, waveform, dot figure, bulb, lens, balance, lamp, ring track, robot, the hero
card), the renderer that stops on a missing font, a word count from the drawn SVG (film_beats.js) and
fit_durs.py, the bundled Outfit font, the loop-promo example, and references/long-film.md with the method and
every lesson from three versions of a real promo: story before look, one idea one shape, real-line rules, fact-check
before rendering, contact sheets of every cut. render.py --per-shot makes the sheet and lists labels cut by the
frame. Tested cold by a fresh agent on a new topic; its findings are folded into the guide.THIRD_PARTY_NOTICES.md (opens in a new tab)examples/expenses/beats.json (opens in a new tab)examples/expenses/style-a/eras_expenses.js (opens in a new tab)examples/expenses/style-a/expenses.js (opens in a new tab)examples/expenses/style-a/meta.json (opens in a new tab)examples/expenses/style-b/board.js (opens in a new tab)examples/expenses/style-b/eras.js (opens in a new tab)examples/expenses/style-c/expenses.js (opens in a new tab)examples/expenses/style-c/expenses.svg (opens in a new tab)examples/loop-promo/film.html (opens in a new tab)examples/pizza/beats.json (opens in a new tab)examples/pizza/style-a/eras_pizza.js (opens in a new tab)examples/pizza/style-a/meta.json (opens in a new tab)examples/pizza/style-a/pizza.js (opens in a new tab)examples/pizza/style-b/board.js (opens in a new tab)examples/pizza/style-b/eras.js (opens in a new tab)examples/pizza/style-c/pizza.js (opens in a new tab)examples/pizza/style-c/pizza.svg (opens in a new tab)examples/pizza/style-c/theme.css (opens in a new tab)references/agent-briefs.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub wan-huiyan/wiggle-that-diagram --plugin wiggle-that-diagram