/motion2code:motion2codefrom Motion2Code
Rebuilds flat motion design videos or UI recordings into editable code: inline SVG shapes animated by GSAP timeline, with frame-by-frame verification, seamless looping, and optional conversion to interactive websites with ScrollTrigger.
Ships in Motion2Code. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
The video is the spec, and you cannot watch it. Treat the job as reconstruction: turn the clip into images you can look at, write down what happens and when, build the shapes, drive them with one clock, then prove every moment against the source with images side by side. Never animate from a memory of the video.
python3 scripts/study_video.py source.mp4 -o study/ saves a frame every 0.25 s, the
frames around every cut, a contact sheet, the exact flat palette and whether the source already loops. Open the
sheet, then the frames. Read the prompt file next to the video if there is one: it holds the exact words.references/study-the-source.md.templates/index.html: one inline SVG at the source resolution, every shape drawn
around its own origin, flat fills from the sampled palette, the closest Google Font subset to the exact letters.draw(t) for procedural parts (particles,
morphs, physics) called from the same clock. Match the timing of the frames, not your idea of it.
See references/animation-architecture.md and references/motion-vocabulary.md.references/seamless-loop.md.python3 scripts/frame_diff.py source.mp4 index.html -o diff/ writes source|code pairs and a score per time;
open the pairs, fix the worst first, then zoom on transitions with --every 1/24 --start a --end b.
python3 scripts/check_anim.py index.html --runtime checks the contract, the loop seam, determinism, console
errors and network. Ship only when both are clean. See references/verification.md.index.html, compare.html (from templates/compare.html), and when asked the proof videos:
python3 scripts/render_anim.py index.html -o anim.mp4 then
python3 scripts/side_by_side.py source.mp4 anim.mp4 -o side_by_side.mp4 --html index.html.site.html from
templates/site.html: scroll becomes ScrollTrigger, fake clicks become real buttons.
See references/interfaces-and-sites.md.Scripts need Python 3.9+, ffmpeg, and Playwright for anything that opens a browser
(uv run --with playwright python scripts/..., or pip install playwright && python -m playwright install chromium).
Run them from this skill's directory or with full paths.
window.anim = { tl, duration, seek(t), play(from), pause() } // seek(t) is a pure function of t
index.html?t=6.5 freezes at 6.5 s; ?external=1 does not autoplay (compare.html and the scripts drive it);
with no parameter it plays by itself and loops forever.<html data-ready="1"> once fonts are loaded and frame 0 is drawn. Renderers wait for it.frame(duration) equals frame(0); frame(duration - 1/24) is one step away from it.<img>, <video>, SVG <image>, canvas drawImage or raster data URI in the animation.stroke-linecap="round" for sticker outlines.requestAnimationFrame loops, setTimeout choreography, CSS
animations or Date.now() driving visuals. Randomness is seeded and precomputed.Read only what the task needs:
| File | Read when |
|---|---|
references/study-the-source.md | starting: frames, cuts, palette, shot list, words, duration, aspect |
references/animation-architecture.md | building: stage, shape origins, timeline vs draw(t), keyframe helper, morphs, fonts, determinism |
references/motion-vocabulary.md | matching the feel: snaps, squash and stretch, smears, elastic settles, iris wipes, morph chains |
references/seamless-loop.md | the source does not loop, or the seam jumps |
references/verification.md | checking and proof videos: frame_diff, compare.html, check_anim, render, side by side |
references/interfaces-and-sites.md | the source is a website/app recording, or a real site.html is wanted |
Templates: templates/index.html (the contract, a tiny looping example), templates/compare.html (video and code
side by side, synced to the video clock, frame stepping, onion skin), templates/site.html (ScrollTrigger pin and
scrub, menu, tabs, flip card, draggable slider, cart counter, keyboard, reduced motion).
index.html (+ compare.html, + site.html for interfaces) and say what was checked and how:
frame_diff times, worst scores and what they were, check_anim.py --runtime result, page size.agents/openai.yaml (opens in a new tab)references/animation-architecture.md (opens in a new tab)references/interfaces-and-sites.md (opens in a new tab)references/motion-vocabulary.md (opens in a new tab)references/seamless-loop.md (opens in a new tab)references/study-the-source.md (opens in a new tab)references/verification.md (opens in a new tab)scripts/_m2c.py (opens in a new tab)scripts/check_anim.py (opens in a new tab)scripts/frame_diff.py (opens in a new tab)scripts/palette.py (opens in a new tab)scripts/render_anim.py (opens in a new tab)scripts/side_by_side.py (opens in a new tab)scripts/study_video.py (opens in a new tab)templates/compare.html (opens in a new tab)templates/index.html (opens in a new tab)templates/site.html (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
svg, gsap, motion-design, animation, video-to-code, scrolltrigger
npx claudepluginhub lovisdotio/motion2code --plugin motion2codeOther plugins' skills for the same job