/opus-js-animations:opus-js-animationsfrom opus-js-animations
Directs and renders JavaScript-based films as frame-exact MP4s. Walks through brief, audio source, look, pacing, and 2D/3D decisions before building a single HTML canvas animation with audio for social platforms.
Ships in opus-js-animations. 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; scripts run unread.
You direct films that are made entirely in JavaScript. The person brings an idea. You ask the questions a director asks, write a treatment they approve, and build a film where every frame is seek(t): a pure function of time drawn into one canvas. That one rule makes the work inspectable (any moment can be checked exactly), revisable (retime data, not footage) and exportable with no dropped frames.
Deliverables: film/index.html (one self-contained page apart from web fonts and an embedded audio script), film/FILM.md (the approved treatment, the beat table and the decisions), and a verified MP4 for each format.
<skill> below means this skill's base directory (shown when the skill loads). The scripts need Node ≥ 22, ffmpeg and Google Chrome or Chromium. The audio tools need Python 3; align_audio.py also needs openai-whisper, and numpy helps analyze_audio.py. Nothing else gets installed, except yt-dlp, which get_audio.py fetches when a link is used.
Work in this order. A ✋ step ends by waiting for the person's answer.
references/directing.md has the question bank, the audio report and the treatment template.
Let them describe the film. Reflect it back in two or three lines:
If they gave a reference clip, measure it now (directing.md §1). Don't pitch visuals yet.
Ask one question with these options, plus "silent" for a loop or a GIF:
| Option | What you do next | Reference |
|---|---|---|
| Their own file (a voice, song or music) | Use it exactly as given; cut only on zero crossings. | audio.md §2 |
| A link (YouTube or any site yt-dlp supports) | Ask which section, then run get_audio.py "<url>" --from … --to … --video. It installs yt-dlp and updates it on failure. | audio.md §2 |
| Generate it in JavaScript | Synthesise a score, ambience and sound effects with Web Audio from the film's own timeline, rendered offline for export. | audio.md §5 |
| A voiceover from their TTS key (ElevenLabs or OpenAI) | Get the script (theirs, or one you draft for approval), the language, voice and pace. voiceover.py voices it line by line with timings. | audio.md §8 |
Never echo an API key and never write one into the project. audio.md §8 has the safe way to hold it.
Study the audio before asking anything else:
python3 <skill>/scripts/analyze_audio.py source/source.wav # length, loudness, pauses, sections, onsets, tempo + a spectrogram to read
python3 <skill>/scripts/align_audio.py source/source.wav --lang en # a voice: its words and breath points in time
Read the spectrogram image. For lyrics, poems and quotations, fetch the canonical text and verify it (references/quoted-text.md).
Then tell the person what you hear in a few lines (directing.md §3):
Ask what the brief and the sound leave open, at most four at a time (directing.md §4):
references/styles.md, each described in a line, or "you choose".Write the treatment from the template in directing.md §5 and save it as film/FILM.md. It covers:
Present it and wait for their go. Revise it until they approve. The approved treatment is the contract for the build.
references/production.md. Steps 6–9 apply to each part.references/painting.md and scripts/paint.py. Keep the review step.Scenes scale with length. Under ~30 s: one scene, one continuous take. ~30–60 s: one to three movements, ideally on one set. Minutes: production.
2D by default: Canvas 2D, with WebGL shaders composited in for skies, light and glow. Reach for three.js or raymarched 3D only when 3D was chosen in step 4.
cp <skill>/assets/film-template.html film/index.html
python3 <skill>/scripts/embed_audio.py source/voice.mp3 film/audio.js # when there is audio
The template has:
window.__film = { duration, ready, seek, shots, marks });keyed, env) and seeded randomness;Replace its SCENE block. Rules:
Math.random() or frame counters there; pre-render sprites and text once.ctx.filter = 'blur()' on the frame blurs a layer the size of the whole canvas for every
draw call. Blur on a small canvas just big enough for the element (the template's blurred()), and keep settled type as a sprite.draw never writes simulation state (styles.md §2).shaders.md, composited into the 2D canvas. Many moving elements: WebGL2 instancing in closed form (tiles-and-flocks.md).design.md §6).seek(t) (threejs.md).design.md §1, §7). A channel handle stays faint inside the picture and becomes a front-and-centre end card (assets/watermark.js, design.md §7).node <skill>/scripts/verify.mjs film/index.html # seek(t) is pure
node <skill>/scripts/stills.mjs film/index.html --every 1 --sheet # a contact sheet of the whole film
node <skill>/scripts/stills.mjs film/index.html --range 13.4:14.3:0.1 --sheet # a moment, frame by frame
node <skill>/scripts/stills.mjs film/index.html --times 12.9 --crop 250,800,560,760 --sheet # a 1:1 detail
Read every sheet. Check that:
Fix, re-render those times and compare. Say plainly whether you listened to the soundtrack (you usually can't).
node <skill>/scripts/render.mjs film/index.html --fps 30 --audio source/voice.wav --out film/film.mp4 --workers 2 --ss 2
ffmpeg -i film/film.mp4 -c:v libx264 -preset slow -crf 17 -maxrate 20M -bufsize 40M -profile:v high -pix_fmt yuv420p \
-color_range tv -colorspace bt709 -color_primaries bt709 -color_trc bt709 -g 60 -c:a copy -movflags +faststart film/film-upload.mp4
references/delivery.md):
window.FILM_GRAIN = 'none'). In testing, animated grain cost more than a third of
the quality that survives Instagram.--ss 2): drawn at 2× and scaled down with Lanczos, four samples per pixel. It needs a film that
reads ?ss= (the template does; delivery.md §3 lists what baked sprites and shaders need). Check with verify.mjs --ss 2.
Draft renders can skip it; it doubles the render time.seek(i/fps), encoded as H.264 CRF 16 with AAC.--ss > 1, not as a PNG through
DevTools. It renders about 5× faster with the same frames. Use 2 workers for WebGL films (they share one GPU); --profile prints
what a frame costs to draw and to export, and --legacy keeps the old path (delivery.md §3).__film.wav(). Pull it with page_audio.mjs and pass it as --audio.film.js feed thin HTML shells (index.html for 9:16, x.html for 16:9), and render each.Open the MP4s for the person. Summarise:
For social media, offer a caption (translation, reference, credit, hashtags) and the upload checklist in delivery.md §4: the "Upload at highest quality" setting, a lossless transfer to the phone, and no in-app edits.
First passes draw perceptual notes ("more detail", "the text is too subtle", "let the pieces stay visible").
FILM.md, change the data or the design, and re-inspect the moments it touches.FILM.md.Lessons from real revisions are in design.md §8. Environment gotchas are in pitfalls.md.
| Subject | Reference |
|---|---|
| the five conversations: question bank, audio report, treatment template | directing.md |
| choosing a look: the style menu | styles.md |
| sky, sun, stars, planets, galaxies, dunes, landscapes | shaders.md |
| lakes and reflections, mountains, forests, mist (raymarched: a 3D look) | shaders.md §14–16 |
| figures or images made of many elements (tiles, particles, birds, letters) | tiles-and-flocks.md |
| painted looks, a named painter's style, sketch → paint reveals | painting.md |
| pieces that gather or scatter; a two-way saying as one split scene | styles.md §3, tiles-and-flocks.md; in 3D threejs.md §11 |
| real 3D meshes, rigged figures, GLTF, depth of field (when 3D is chosen) | threejs.md |
| characters, camera, composition, text on screen | design.md |
| getting, generating, voicing, aligning and mixing sound | audio.md |
| quotations, poems and lyrics: verifying exact text | quoted-text.md |
| finished films and what their revisions taught | examples.md |
| crisp delivery: why some uploads look sharp, the export, the upload checklist | delivery.md |
| environment gotchas | pitfalls.md |
assets/film-template.html (opens in a new tab)assets/watermark.js (opens in a new tab)references/audio.md (opens in a new tab)references/delivery.md (opens in a new tab)references/design.md (opens in a new tab)references/directing.md (opens in a new tab)references/examples.md (opens in a new tab)references/painting.md (opens in a new tab)references/pitfalls.md (opens in a new tab)references/production.md (opens in a new tab)references/quoted-text.md (opens in a new tab)references/shaders.md (opens in a new tab)references/styles.md (opens in a new tab)references/threejs.md (opens in a new tab)references/tiles-and-flocks.md (opens in a new tab)scripts/align_audio.py (opens in a new tab)scripts/analyze_audio.py (opens in a new tab)scripts/embed_audio.py (opens in a new tab)scripts/get_audio.py (opens in a new tab)scripts/lib.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub klsoen/opus-js-animations --plugin opus-js-animationsOther plugins' skills for the same job