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:

    1. First check whether any stickman animation Skill exists under .claude/skills in the current working directory (current directory only).
    2. If not, generate a single-page code animation for a 15-second, 16:9 landscape canvas.
    3. Theme: three pain points of a one-person company producing overseas short videos, split into 3 scenes, no unrelated decoration.
    4. 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:

    1. Head-to-body ratio was stiff, with no mathematical basis, so character proportions drifted on every generation
    2. Arm lines were crooked, and joint angles did not match intuitive human kinematics
    3. 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:

    1. .claude/skills/stickman-animator/
    2. ├── SKILL.md # Triggers, skeleton parameters, motion vocabulary, output spec
    3. ├── assets/
    4. │ └── rig.json # Baseline rig parameters (node coordinates and hierarchy)
    5. └── scripts/
    6. ├── render.js # Drives a headless browser to export frame by frame at 30/60fps
    7. └── 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:

    1. {
    2. "unit": "torso_length",
    3. "head_ratio": 0.62,
    4. "shoulder_width": 0.85,
    5. "hip_width": 0.55,
    6. "upper_arm": 0.9,
    7. "forearm": 0.85,
    8. "thigh": 1.0,
    9. "shin": 0.95
    10. }

    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:

    1. // Core logic of render.js
    2. const fps = 60, duration = 15;
    3. for (let f = 0; f < fps * duration; f++) {
    4. await page.evaluate((frame) => window.seekTo(frame), f);
    5. await page.screenshot({ path: `frames/${String(f).padStart(4, '0')}.png` });
    6. }

    For encoding, combine the image sequence into a video. Example command:

    1. ffmpeg -framerate 60 -i frames/%04d.png -i voice.mp3 \
    2. -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:

    1. Build the specification before chasing efficiency. Without skeleton and output specifications, the money saved will be repaid double in rework.
    2. Prioritize observability. Add logging and timing statistics to the render and encode stages so you can tell whether generation or encoding is the bottleneck.
    3. 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