svg-path-draw — Claude Code rule: what it does, how to install
svg-path-draw — a rule that gets the agent to trace an SVG outline stroke by stroke, then fade in a wordmark once the drawing settles.
AGPL-3.0 ★ 78,316 updated 2026-10-24
.claude/rules/svg-path-draw.mdWhat svg-path-draw does
The rule hands the agent a working recipe for a shape that draws itself. Two stroke properties carry it: the dash pattern spans the path's whole length, and the dash offset runs from that length down to zero. The length comes from path.getTotalLength(), so it is measured geometry rather than a hardcoded number.
You get an HTML scene with several <path> elements, CSS that leaves strokes unfilled with round caps, and a GSAP timeline built paused. Each segment begins before the previous one finishes, which is why the result reads as one motion and not three separate tweens. A table of ranges covers the timings: 0.3-0.8s for a segment draw, 0.25-0.6s for the shorter closing segment, 0.3-0.8s for the fade. Easing is a discrete pick, power2.out on strokes and power1.out on the fade, with bouncy curves such as back.out ruled out.
GSAP arrives through a script tag from cdn.jsdelivr.net. Miss it and there is no gsap.timeline to call, so the scene stays empty. The wordmark fade has a hard floor too: it must start at or after the end of the last stroke, otherwise the text competes with a line still being drawn.
What it helps with
- trace a logo outline on page load
- chain several strokes so they read as one motion
- size a segment's duration to its actual length
- hold the wordmark back until the drawing settles
Example prompts for the agent
- Build a scene where the logo draws itself and the caption fades in after the last stroke.
- Check that
BRAND_FADE_STARTcomes afterSEG_3_STARTplusFINAL_SEGMENT_DUR. - Set
strokeDasharrayfromgetTotalLength()on everypath.
How to install svg-path-draw
Manually: put the files in place
.claude/rules/svg-path-draw.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/svg-path-draw.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/svg-path-draw.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/svg-path-draw.mdManually: put the files in place
.clinerules/svg-path-draw.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about svg-path-draw
How do I install svg-path-draw in Claude Code?
Place .claude/rules/svg-path-draw.md in your project; the rule is picked up from that folder.
What does svg-path-draw do?
It spells out how to reveal an SVG stroke gradually with stroke-dasharray and stroke-dashoffset, plus a GSAP timeline with timing ranges for each segment.
Why is back.out off limits for the stroke?
Strokes use power2.out so the line slows at the end like a lifted pen instead of springing. For a constant-speed trace the rule suggests none.