Major Release • November 1, 2026 • By chriz-3656

Pencil2D MCP v0.4.0: 2-Bone Inverse Kinematics, Grounded Gait Locomotion & Sakuga Combat

How we solved stiff AI drawings, ice-skating legs, and teleporting joint movements to produce broadcast-grade 24 FPS 2D animation.

The Challenge: Why AI Animation Often Looks "Stiff"

When Large Language Models or Python agents author 2D drawings by default, they frequently fall into a predictable trap: generating rigid lines with uniform angular spacing and sliding positions. Even when stick figures are drawn with articulated segments, characters often end up sliding across the ground like cardboard cutouts, popping abruptly between keyframed poses without weight or inertia.

With Pencil2D MCP v0.4.0, we set out to eliminate stiffness entirely by integrating the physics and kinematics used in high-tier martial arts animation (such as Hyun's Dojo and Alan Becker) into a mathematical, reproducible Python engine.

24 FPS Fluid Stickman Kinematics

24 FPS Fluid Stickman Kinematics (240 Frames) — Featuring grounded gait foot planting, passing leg clearance, and circular Wing Chun hand deflections.

1. Analytic 2-Bone Inverse Kinematics (IK)

Rather than guessing knee or elbow coordinates through manual offset magic numbers, solve_2bone_ik() computes exact joint angles using trigonometry and the Law of Cosines:

cos(α) = (L₁² + d² - L₂²) / (2 · L₁ · d)
joint_angle = base_angle ± α

By clamping target distance to the natural reach boundary (abs(L₁ - L₂) < d < L₁ + L₂), limbs never hyper-extend, pop, or stretch unnaturally. Both thighs and calves maintain constant pixel lengths throughout the entire 10-second sequence.

2. Grounded Bipedal Locomotion Engine

Authentic human and character locomotion adheres to distinct phases of ground support:

24 FPS Ultimate Sakuga Anime Fight

24 FPS Ultimate Sakuga Combat — Destructible stone pillars, flaming katana, sliced boulders, inverted impact frames, and camera shake.

3. Continuous Pose Interpolation (Zero Teleporting)

Transitions between actions (standing, walking, running, crouching, and kicking) are blended continuously using cubic Hermite smoothstep curves (s(t) = 3t² - 2t³) across all 15 joints. Every joint trajectory is C¹ continuous—ensuring no single-frame teleport jumps occur.

4. Expanded MCP Toolset: 17 Tools Total

Version 0.4.0 also adds three powerful new tools:

  1. pencil2d_look: Generates visual contact strips (filmstrips with optional onion skinning) so AI agents verify visual quality headlessly without a graphical desktop.
  2. pencil2d_generate_animation: Generates stylized animation presets across 5 distinct aesthetics: Stickman, Anime, Pencil Sketch, Studio Ghibli, and Doodle.
  3. pencil2d_get_guide: Provides on-demand craft instructions directly to the LLM covering the 12 principles of animation, line-of-action kinematics, and timing charts.

Try It Out Today

Upgrade to v0.4.0 directly via PyPI:

pip install --upgrade pencil2d-mcp