Quick Answer: A line art animation draws figures as open pen strokes and moves them frame by frame. JDhruv14's project does this live in SVG with four dependency-free TypeScript modules, so drawings stay sharp at any size and respond to the pointer. Its
gait()solver computes legs from travel speed, and a palette function shifts the scene from day to night.
Most line art animation you'll find online is a pre-rendered GIF: fixed pixels, fixed timing, no response to anyone touching it. JDhruv14's line-art-animation repository takes a different route. It draws ink-on-paper figures that walk, ride and react inside scenes that run from afternoon to midnight, all in live SVG. Below, I'll walk through how the drawing works, how the walk is solved rather than keyframed, how the day-night cycle is handled, and how you'd render the result to video.
Why SVG Suits Line Art Animation
Line art is a poor fit for pixel-based formats. A hand-inked stroke has to stay crisp whether it fills a phone screen or a billboard, and a raster GIF can't do that. SVG is vector, so every stroke is redrawn at the target resolution.
That matters more than it sounds. The repo draws each figure in its own coordinate space, about 95 units tall with the feet on y = 120, then places it into the scene with a transform. You author the figure once and the scene handles scale.
Pointer response is the other benefit. Every stroke is a DOM element, so the village can react when you click a window, a lantern, the wind chime or the cat. Canvas can do this too, but you end up writing your own hit-testing. In SVG, the browser already does it.
How a Limb Becomes a Hand-Inked Stroke
Here's the part that surprised me most: the hand-drawn look doesn't come from a fancy brush. It comes from structure. Each limb is two open pen strokes drawn around a curve through the joints, and the stroke is passed through an SVG filter so the edges look inked.
The core setup is short. The example below draws a pair of legs walking across the page:
import { el, limb, shoe, place, inkDefs, run } from './lib/ink.ts';
import { gait } from './lib/gait.ts';
const svg = el('svg', { viewBox: '0 0 480 240' });
document.body.append(svg);
const fig = el('g', { filter: inkDefs(svg).filter }, svg);
const legs = [limb(fig, 4.2), limb(fig, 4.2)];
const shoes = [el('path', {}, fig), el('path', {}, fig)];
Each frame, the loop reads the gait pose and redraws the limbs from the hip, knee and ankle points. The cause and effect is simple: change the joint positions, and the strokes follow. The "ink" look appears because the two open strokes never quite meet, which is how a real pen line behaves at its ends.
Most people stop at the legs. Don't. Clothing is drawn around the knees and ankles, so a coat or kimono opens and closes with the stride. That's a small detail, but it's what sells the figure as a person rather than a diagram.
Solving the Walk Instead of Keyframing It
This is where the project departs most from common advice. The usual approach to a walk cycle is to keyframe a set of poses and interpolate between them, or to drive each joint with a sine wave. Both fail the same way: the feet slide. A sine-driven leg has no idea how fast the body is moving, so the planted foot skates across the ground.
The gait() function solves the legs instead. Its rules, as the README describes them:
- The planted foot slides back at exactly the travel speed, so it stays put.
- The swing foot follows a minimum-jerk path, the smooth trajectory modelled in Flash and Hogan's 1985 study of human arm movement.
- The heel peels off the toe before each step.
- Hip height comes from what the planted legs can reach.
Rule 4 is the counter-intuitive one. Most people assume the body should bob up and down on a fixed curve. In this solver, the body rises over each step because the planted legs have to stretch to reach forward, and it dips when both feet are down. The bounce is a consequence of geometry, not a motion you added. The practical result is that a walk looks natural across different speeds without retuning.
There's a trade-off here. A solver is more work to set up than a keyframe sheet, and it only handles the motions it was built for. If your figure needs to crouch, climb or dance, you're writing new constraints. For a walk or run, though, the solver is the better default.
One Palette for Day and Night
The village runs from late afternoon through to night, and the colour logic is elegant. palette(τ) returns sky, paper and ink colours for any time of day, where τ is the position in the cycle. Ink is set to currentColor, and paper fills carry a pp class. That means applyPalette() can change the whole drawing from dark ink on cream paper to pale ink on indigo, while windows and lanterns glow.
Here's a quick comparison of the three ways you might build a scene like this:
| Approach | Resolution independent | Pointer interaction | Frame-exact video export |
|---|---|---|---|
| Pre-rendered GIF or PNG sequence | No, fixed pixels | None without extra code | Already frozen, no control |
| Canvas 2D, redrawn each frame | Only with manual devicePixelRatio handling | Manual hit-testing | Yes, with a controlled loop |
| Live SVG (this repo) | Yes, vector at any size | Native DOM events per element | Yes, using the capture script |
The one-palette approach has a real caveat. Because every paper fill depends on the pp class, any element you add later with a hard-coded colour won't follow the cycle. Check new elements at both ends of the day before you call them finished.
Rendering the Animation to Video
The repo ships a deterministic capture script, so the video doesn't depend on how fast your machine is. The script drives headless Chrome over the DevTools protocol, advances the scene by exactly one frame between screenshots, and saves each frame to disk. Then ffmpeg encodes them. To render a 30-second 1080p clip, the steps are:
- Start the dev server with
npm run dev, which runs on Node 22.18 or newer. - Run the capture command with
?debug&capture&day=30&start=0.3, asking for 900 frames at 30 fps over 1920x1080. - Encode the frames with ffmpeg using
libx264,-crf 15,-tune animationand-pix_fmt yuv420p.
Each step matters. The debug flag stops time from running on its own, so the capture controls it. The day=30 flag makes a full cycle last 30 seconds, which matches the frame count. And -tune animation helps flat colour areas compress cleanly, which is exactly what line art is. You'll need a local Chrome or Chromium, or a path set in $CHROME, plus ffmpeg installed.
Matching a Reference Clip
If you have a real clip and want your drawing to match its walk, the repo includes measuring tools. scripts/clip.ts can find the loop length of a region with period, and count dark blobs per frame with blobs, which is useful for tracking feet. scripts/frames.sh extracts frames with a measuring grid over them, so you can read poses directly.
The main pitfall is frame rate. Most social clips are variable frame rate, so counting frames gives you the wrong timing. The fix is to resample by time instead. That's the single most useful habit in the reference guide, and it's easy to skip when you're in a hurry.
Using the Claude Skill
The repo is also a Claude skill, and it's built for Claude Code. Clone it into ~/.claude/skills/line-art-animation or into .claude/skills/ inside a single project. Then ask for what you want: a bakery at dawn, a walk matched to a clip, a day-night cycle with a rendered video.
Claude reads SKILL.md, copies lib/ into your project, and shows one figure for your approval before building the rest. It also checks motion frame by frame before it hands the work back. That approval step is the key safeguard. Once the walk looks wrong, every scene built on it will look wrong too, so catching it early saves time. The skill is only as good as the instructions you give it, so describe the mood and timing you want, not just the subject.
Frequently Asked Questions
What is line art animation?
Line art animation is motion drawn with open, unfilled strokes, often in an ink-on-paper style. In this project, each figure is built from pen strokes in SVG, and the strokes move frame by frame. Because it's vector, the result stays sharp at any size and can respond to clicks or pointer movement.
How to animate a walk cycle in SVG?
Draw each leg as two open strokes through the hip, knee and ankle, then compute the joint positions each frame. The gait() solver in this repo does this: the planted foot slides at the travel speed, the swing follows a minimum-jerk path, and the hip height comes from what the legs can reach. Set the speed, then call the pose each frame.
Why does my animated walk look stiff?
Stiffness usually comes from keyframing or sine waves, which ignore how fast the body moves, so the feet slide and the bounce looks mechanical. Solve the legs from the travel speed instead, and let the hip height follow from leg reach. Adding clothing that opens and closes with the stride helps too.
Can I match an existing video clip exactly?
Yes, with a caveat. The repo's clip.ts and frames.sh scripts help you measure the loop length and read poses from frames. Resample by time, not by frame count, because most social clips are variable frame rate. Then overlay your drawing on the clip to check the match.
Want to see how this works in practice? Clone the repo, run npm run dev, and drag the sun across the village sky. Then pass this to a friend who's stuck animating a walk by hand and needs a solver instead.