How to Package a Stickman Animation Pipeline as a Reusable Skill

    This article explains how to turn a code-driven stickman animation workflow into a reusable Skill package. It covers why unconstrained code generation causes proportion drift, joint errors, and camera distortion; the local prerequisites (Node.js, FFmpeg, and a headless browser); a three-file Skill structure; and the math that keeps character proportions fixed through a RIG of bone lengths and single-joint angles. It also shows how to generate and iterate a 15-second, three-act animation, export it locally to a 720P 60fps MP4, and compare the cost model against cloud generative video.

    1. Why Code-Based Animation Needs a Defined Pipeline

    In animation content production, drawing stickman figures purely in code is a highly cost-effective route: the visuals are built from polylines and circles, rendering overhead is minimal, and changes cost almost nothing to make. But without constraints, letting a large language model freely write animation code leads to familiar problems: skeleton proportions have no mathematical baseline, limb lines come out skewed, and the character’s build shifts abruptly when the camera changes. The root cause is not model capability; it is the absence of a specification that is actually enforced.

    Capturing that specification as a reusable Skill package is the general engineering fix. A Skill is essentially a capability wrapper with a clear entry point: it tells the AI coding tool which files to load in a given situation, which constraints to follow, and which scripts to call. Compared with restating requirements in a prompt, a Skill’s constraints are file-level, versionable, and automatically discoverable and invocable.

    2. Prerequisites

    • Runtime: Node.js, used to run the rendering and export scripts.
    • Media tooling: FFmpeg, used to encode the frame sequence into video.
    • Browser engine: a modern browser such as Chrome or Edge, used for frame-by-frame screenshots in headless mode.

    All three are local dependencies. No cloud GPU is required, and there are no per-second rendering charges.

    3. Failure Modes Without Constraints

    Generating animation with no Skill loaded typically fails in three ways:

    1. Proportion drift: torso and limb lengths are picked at random, so the same character has a different height from one act to the next.
    2. Joint errors: arm polyline endpoints are not computed against bone length, producing “rubber arms.”
    3. Camera distortion: coordinates are not recomputed after camera parameters change, so the figure is stretched or squashed.

    The common thread is that results are not reproducible. The same description generated twice yields visibly different frames, which rules out stable production.

    4. Skill Package Structure

    Create a local animation Skill directory with three parts:

    1. stickman-animator/
    2. ├── SKILL.md # Capability description, trigger conditions, invocation rules
    3. ├── engine.js # Skeleton rendering library: RIG definition + interpolation + drawing
    4. └── export-mp4.js # Headless browser frame capture + encoding/export

    SKILL.md should state the skeleton baseline constants, the coordinate system convention, the valid angle range for each joint, subtitle rendering rules, and export parameters. engine.js exposes only a few functions, for example getting a pose by time, getting coordinates by pose, and drawing a single frame. export-mp4.js drives the local browser and the encoding flow.

    5. Core Logic: Turning a Character into Parameters

    A stickman’s torso and limbs are essentially polylines, and each joint is controlled by a single angle. With the bone lengths in RIG fixed as constants and a joint angle of θ, the child node’s coordinates are the parent’s coordinates plus a polar vector:

    1. const RIG = { torso: 120, upperArm: 60, foreArm: 55, thigh: 70, shin: 65 };
    2. function joint(parent, len, deg) {
    3. const r = (deg * Math.PI) / 180;
    4. return { x: parent.x + len * Math.cos(r), y: parent.y + len * Math.sin(r) };
    5. }

    Each frame linearly interpolates the single-joint angles to produce smooth poses:

    1. const angle = a0 + (a1 - a0) * ease(t); // t is the normalized progress within the frame

    Because bone lengths and camera parameters are locked in RIG, the character’s proportions never change, whether the action or the camera changes. This is the mathematical source of 100% character consistency.

    6. Generation and Iteration: Start with a 15-Second, Three-Act Animation

    Start a new conversation and describe “15 seconds, three acts, bilingual Chinese-English subtitles at the bottom.” The AI coding tool automatically recognizes and loads the Skill package, then produces a single-file web animation that runs steadily at 60 FPS. Later changes are local and incremental: adding a floating-text effect to act two, or a frame-rate and cost badge to act three, only touches the parameters and copy for those acts. The protagonist’s skeleton definition is completely unaffected, and updates usually take minutes.

    7. Local Export: Headless Rendering Plus Encoding

    The export script drives a headless browser frame by frame, then hands the image sequence to FFmpeg to encode a 720P, 60fps MP4. For 900 frames at 15 seconds, local export takes roughly fifty-odd seconds and the output is under 1 MB. The process uses no cloud resources and incurs no additional call fees.

    8. Cost Structure Comparison

    Approach One 15-second clip 30 clips per month Change one line of dialogue Character consistency
    Skill-based code pipeline Very low (mostly local rendering) Linear and controllable Change the code and re-export, about 1 minute Stable
    Cloud generative video Billed by credits/duration Rises linearly with volume Requires regeneration and another charge Prone to drift

    The key difference is the cost model. The generative approach treats a modification as a new generation, so cost and uncertainty happen together. The code approach treats a modification as a parameter change, so cost approaches zero and the result is deterministic.

    9. Applicability Boundaries

    This route is not suited to scenes that need photorealistic human quality, nor to teams with no development environment at all. If the goal is stylized animation content that can be produced in batches and needs frequent copy changes, packaging the skeleton baseline and export flow as a Skill is a practical way to turn “gacha pulls” into production.