Slash Code-Generated Stickman Animations and Cut Production Costs by Over 80%
This article walks through how teams producing short-form videos for global platforms can reduce content production costs by replacing probabilistic video generation with deterministic, code-driven animation. It covers building a baseline without constraints, packaging skeleton specifications and export scripts into a reusable Skill, automating headless rendering and video encoding, and decoupling copy from animation code so that line edits no longer trigger a full regeneration. The approach cut a 15-second, 60 fps animation clip to roughly $0.54 and reduced a monthly bill from $86 to $16, and the article includes practical guidance on specifications, observability, and asset libraries for production use.
1. Background: Why Video Generation Costs Are Hard to Control
For teams shipping short-form videos for overseas audiences, the thing that usually kills momentum is not creativity but the cost structure of the production toolchain. Most mainstream text-to-video models bill by the second, and a monthly allowance of a few tens of dollars simply cannot support rapid trial and error. Character consistency is an even bigger headache: faces drift and roles bleed into each other across shots, so a single line of dialogue change means tearing everything down and re-rolling from scratch. This combination of pay-per-run pricing and uncontrollable output essentially shifts the cost of uncertainty onto the creator.
There is really only one way to bring this kind of cost down: move generation tasks from probabilistic models to deterministic programs.
2. Overall Approach: Turning Skeleton Rules into a Reusable Skill
The advantage of deterministic programs is that results are reproducible and the marginal cost of rendering is close to a fixed value. The pipeline tested here has four layers:
- Specification layer: a structured Skill document that locks in skeleton proportions, joint constraints, and motion naming conventions
- Generation layer: an AI coding tool that produces a single-file animation page from the specification
- Rendering layer: headless browser screenshot capability used to export frames at a fixed frame rate
- Packaging layer: local video encoding used to combine the image sequence into a finished video with an audio track
The key insight is that a Skill is not a longer prompt. It is an engineering contract that can be version-controlled. Prompts are disposable; Skills are assets that accumulate.
3. Step One: Establish a Baseline by Writing Without Constraints
Before packaging any specification, let the model write once with no constraints at all, purely as a comparison baseline. An example prompt looks like this:
First check whether any stickman animation Skill exists under .claude/skills in the current working directory (current directory only).If not, generate a single-page code animation for a 15-second, 16:9 landscape canvas.Theme: three pain points of a one-person company producing overseas short videos, split into 3 scenes, no unrelated decoration.When finished, output the file size and elapsed time.
The result was a single-file page of roughly 11.6 KB, produced in 64 seconds after about two minutes of turnaround. Opening it revealed very typical problems:
- Head-to-body ratio was stiff, with no mathematical basis, so character proportions drifted on every generation
- Arm lines were crooked, and joint angles did not match intuitive human kinematics
- Timeline, styles, and structure were all coupled in one file, making local edits impossible
The conclusion: without a specification, the model redesigns a character every single time instead of reusing the same one.
4. Step Two: Package the Skeleton Specification and Export Tools into a Skill
A Skill should follow a three-part principle: specification, tools, and validation.
Recommended directory structure:
.claude/skills/stickman-animator/├── SKILL.md # Triggers, skeleton parameters, motion vocabulary, output spec├── assets/│ └── rig.json # Baseline rig parameters (node coordinates and hierarchy)└── scripts/├── render.js # Drives a headless browser to export frame by frame at 30/60fps└── encode.js # Combines the image sequence into video and mixes in audio
SKILL.md must spell out three categories of hard constraints:
- Skeleton baseline: head radius to torso length ratio is fixed (for example, head diameter to torso = 1:3.5); shoulder width, hip width, and limb lengths are expressed as ratios relative to torso length, with absolute pixel values forbidden
- Kinematic constraints: knee and elbow joints may only bend in one direction, feet must align with the ground baseline when planted, and mesh clipping through surfaces is forbidden
- Output constraints: the animation timeline must be data-driven (for example, keyframe arrays), and hardcoding coordinates into the rendering logic is forbidden
Example skeleton parameters:
{"unit": "torso_length","head_ratio": 0.62,"shoulder_width": 0.85,"hip_width": 0.55,"upper_arm": 0.9,"forearm": 0.85,"thigh": 1.0,"shin": 0.95}
Expressing proportions this way means character proportions stay constant no matter how the canvas resolution changes, which eliminates the “role bleeding” problem at its root.
5. Step Three: Automate the Render and Export Pipeline
The core of the rendering stage is unifying frame rate and determinism. The recommended approach is to screenshot frame by frame with a headless browser, having the page accept a URL parameter or call a global function to seek to the target frame:
// Core logic of render.jsconst fps = 60, duration = 15;for (let f = 0; f < fps * duration; f++) {await page.evaluate((frame) => window.seekTo(frame), f);await page.screenshot({ path: `frames/${String(f).padStart(4, '0')}.png` });}
For encoding, combine the image sequence into a video. Example command:
ffmpeg -framerate 60 -i frames/%04d.png -i voice.mp3 \-c:v libx264 -pix_fmt yuv420p -c:a aac -shortest out.mp4
Two engineering details are easy to overlook. First, confirm in advance that Node.js, the video encoding tool, and the browser engine are all installed locally; otherwise the entire chain breaks at the rendering step. Second, audio-video alignment: measure the narration duration first and derive the total animation length from it, rather than finishing the animation and then forcing the audio in afterward.
6. Advanced Optimization: Making Dialogue Changes a Zero-Cost Operation
The biggest payoff of a deterministic pipeline is that local edits no longer trigger a full regeneration. Three further layers of optimization are recommended:
- Decouple copy from code: extract narration text into a standalone data file, so changing a line means editing data only and never touching animation code
- Modularize the animation: encapsulate each scene as an independent module and assemble modules onto the timeline through a unified registration mechanism
- Template the keyframes: turn common motions (walking, pointing, nodding, wiping sweat) into reusable templates, so new scenes are built purely by composition
With this in place, the cost of editing a sentence drops from “re-rolling dozens of times” to “re-encoding once.”
7. Measured Costs and Practical Recommendations
In this test, a single 15-second, 60 fps code-generated animation clip cost about $0.54 in total, and the monthly bill fell from $86 to $16, a reduction of more than 80%. Note that this figure comes from a specific test scenario: actual cost will fluctuate with the number of prompt rounds, rendering resolution, and audio track processing complexity, so it should not be extrapolated into a general benchmark.
Three recommendations for putting this into practice:
- Build the specification before chasing efficiency. Without skeleton and output specifications, the money saved will be repaid double in rework.
- Prioritize observability. Add logging and timing statistics to the render and encode stages so you can tell whether generation or encoding is the bottleneck.
- Build an asset library. Put validated Skills, templates, and scripts under version control, so team capacity grows with assets rather than with headcount.
Overall, reconstructing “video generation” as “code + specification + deterministic rendering” is one of the most pragmatic paths to lowering the marginal cost of content production today; and consolidating that specification into a reusable Skill as an open standard is what makes the whole approach scale
