Code-Driven Stick Figure Animation: A Low-Cost Workflow for Frequent Short-Video Production

    Build a repeatable short-video workflow with parametric stick figure rigs, reusable animation rules, and local rendering. This guide explains the geometry, AI-assisted coding workflow, export process, and reported costs, showing where deterministic animation offers better control than generative video—and where it does not fit.

    1. Why Generative Video Can Be a Poor Fit for Frequent Production

    For independent developers and creators producing explainer videos in batches, generative video models may look like a shortcut. In practice, they introduce three recurring challenges.

    1. A pay-per-retry cost model. Each generation involves randomness, making character appearance, composition, and motion difficult to control. Getting a usable shot often requires multiple paid attempts. Changing a line of dialogue can mean regenerating the entire clip, adding another round of costs.

    2. Inconsistent characters. Faces and body proportions can drift across shots and scenes. This is a serious limitation for explainer videos in which the same protagonist needs to appear throughout.

    3. Coarse editing controls. Adding a small badge to one scene or changing a subtitle may require full regeneration rather than a targeted edit.

    The underlying mismatch is that generative workflows assign deterministic requirements to a probabilistic model. Stick figure animation, by contrast, consists of simple geometric shapes that can be described mathematically. That makes it a strong candidate for a code-driven workflow.

    2. The Core Idea: Replace Drawing with Calculation

    2.1 A Stick Figure Is a Parametric Set of Polylines

    Geometrically, a stick figure’s torso and limbs are a collection of polylines. Joint motion can be described using rotation angles:

    • A full-body pose is a vector of joint angles.
    • A frame is produced by interpolating those angles and applying forward kinematics with fixed bone lengths to calculate each joint’s 2D coordinates.
    • An action is a sequence of keyframes connected by smooth angle interpolation, such as an ease-in/ease-out curve.
    1. // Forward kinematics: calculate a child joint from the parent
    2. // position, bone length, and angle.
    3. function solveJoint(parentX, parentY, boneLength, angleRad) {
    4. return {
    5. x: parentX + boneLength * Math.cos(angleRad),
    6. y: parentY + boneLength * Math.sin(angleRad),
    7. };
    8. }
    9. // Interpolate angles between frames.
    10. function lerpAngle(a, b, t, ease) {
    11. const k = ease(t); // For example, smoothstep.
    12. return a + (b - a) * k;
    13. }

    2.2 Fix the Rig to Keep Character Proportions Consistent

    The key to preventing character distortion is to define bone proportions, bone lengths, the head-to-body ratio, and accessory dimensions—such as glasses—in a single rig configuration, or RIG.

    Every action and every shot calculates coordinates from that same configuration. Because rendering is determined by parameters rather than random sampling, changing the action, camera framing, or output resolution preserves the defined body proportions.

    This provides a deterministic consistency guarantee that probabilistic generation alone does not offer.

    3. Package the Rig and Animation Rules for Reuse

    Asking an AI coding assistant to write animation code from scratch can produce unpredictable results. Without a mathematical reference, body proportions may be inconsistent, arm lines may be misaligned, and the character may change between shots.

    A more reliable approach is to package the drawing rules into a reusable local capability package that the assistant follows each time.

    A typical package contains three components:

    Component Responsibility
    Capability guide in Markdown Defines rig specifications, bone-length ratios, available motion primitives, and conventions for shots and subtitles
    Rendering engine script library Implements forward kinematics, angle interpolation, polyline drawing, and subtitle overlays
    Export script Uses a local headless browser to render frames and an open-source video encoder to produce the final video

    The production workflow then becomes:

    1. Describe the storyboard in conversation—for example, “15 seconds, three scenes, with English and Chinese subtitles at the bottom.”
    2. Have the assistant identify and load the capability package, then generate an animation page that follows the RIG specifications.
    3. Preview the animation in a local browser at 60 FPS.
    4. Request targeted changes, such as “add floating cost text in scene two” or “add a parameter badge in scene three.”

    These revisions affect only a few lines of code. In the described workflow, they can be completed in one or two minutes without changing the protagonist’s rig.

    4. Export Locally Without a Cloud GPU

    The export process can also run entirely on a local machine. The prerequisites are a scripting runtime, a headless browser, and an open-source video encoding tool. Common desktop browsers provide a headless mode.

    The export script renders the animation at explicit timestamps and captures each frame:

    1. // Export workflow pseudocode.
    2. for (let frame = 0; frame < totalFrames; frame++) {
    3. const t = frame / fps;
    4. renderFrame(t); // Calculate and draw the rig at this timestamp.
    5. await captureScreenshot(); // Capture the frame in a headless browser.
    6. }
    7. // Pass the captured frame sequence to a video encoder.

    In the reported test, a 15-second, 60 FPS video at 720p contained 900 frames. Rendering and encoding took approximately 52 seconds, and the output file was smaller than 1 MB. The process used no cloud compute.

    These figures describe the reported run rather than a universal performance guarantee.

    5. Cost Comparison with Generative Video

    The following comparison uses the reported costs for a complete production cycle, including creation, multiple revisions, and export testing.

    Approach Cost per 15-second video Cost for 30 videos per month Cost to change one line of dialogue Character consistency
    Code-driven capability package About $0.54 About $16.20 $0 additional generation fee; edit the code and re-export in about 52 seconds Fixed rig proportions remain consistent
    Generative video approach A About $0.75 About $22.50 Another paid generation attempt Prone to drift between shots
    Generative video approach B About $2.88 About $86.40 Another paid generation attempt Prone to facial distortion

    The difference is not only the initial price. It is also the structure of revision costs.

    In the generative workflow described here, a small script change triggers another full paid generation. In the code-driven workflow, changing dialogue means editing a few lines of text and spending roughly a minute exporting again.

    For creators who revise scripts frequently, repeated regeneration can make monthly costs several times higher. Local re-export still uses the creator’s machine and time, but it does not require another paid video-generation request.

    Cloud object storage and message queues can also support batch distribution, allowing rendered outputs to become part of an automated publishing pipeline.

    6. Where This Workflow Fits—and Where It Does Not

    This approach is not a replacement for every kind of video production.

    Good fits include:

    • Stick figure animation, flat geometric visuals, and data-visualization-driven explainers.
    • Short videos whose scripts need frequent revisions.
    • Creators with a basic development environment: a scripting runtime, browser, and video encoder.

    Poor fits include:

    • Content requiring photorealistic people.
    • Complex physics simulations or detailed materials and lighting.
    • Users who have no development environment and do not want to work with code.

    A practical implementation has three stages:

    1. Build the local rig and rendering engine. Fix the character’s proportions and establish a shared geometric reference.
    2. Document motion primitives and storyboard conventions. Put these rules in the capability guide so an AI coding assistant can reuse them consistently.
    3. Connect the headless rendering and export pipeline. Turn the animation page into an encoded video.

    Once the pipeline is established, producing another video becomes primarily a matter of writing the storyboard and script, followed by roughly a minute of export time in the reported setup.

    Conclusion

    Code-driven stick figure animation replaces uncertain generation attempts with a deterministic production process. A parametric rig preserves character proportions, code edits avoid repeated paid regeneration, and local rendering removes the need for cloud rendering compute.

    For visual formats that can be described mathematically, this approach offers clear advantages in cost, iteration speed, and control. If repeated generation charges and inconsistent characters are slowing down short-video production, a reusable local animation package is a practical alternative worth building.