motion2code · lovisdotio, copilot — Claude Code rule: video animation
motion2code is a Claude Code rule that rebuilds source video as inline SVG animation in index.html, compare.html, and site.html. It activates for those files.
MIT ★ 361 updated 2026-10-20
.github/instructions/motion2code.instructions.mdWhat motion2code does
motion2code defines how to recreate a source video as one inline SVG driven by a single GSAP 3 timeline. The page must avoid <img>, <video>, and raster content. It keeps the prompt wording exact and uses flat sampled colors.
The rule exposes window.anim with tl, duration, seek(t), play(from), and pause(). ?t= holds the animation at a chosen time, while ?external=1 disables autoplay. Once ready, the page sets <html data-ready="1">; the final moment must match the opening frame exactly.
Copy the file into .github/instructions/. Agent mode also uses gh skill install lovisdotio/motion2code motion2code. Validation runs through scripts/check_anim.py --runtime and scripts/frame_diff.py. The rebuild depends on the supplied source video.
What it helps with
- rebuild source video as inline SVG
- expose animation controls through
window.anim - freeze the scene at a value from
?t= - disable autoplay for external mode
- compare the final frame with the opening frame
Example prompts for the agent
- Rebuild
index.htmlfrom the source video as one inline SVG driven by GSAP 3. - Add
window.animcontrols and?t=handling tocompare.html. - Run
scripts/check_anim.py --runtimeandscripts/frame_diff.pyforsite.html.
How to install motion2code
Manually: put the files in place
.github/instructions/motion2code.instructions.mdThe applyTo field sets which files it applies to
1Plugin marketplace
/plugin marketplace add lovisdotio/motion2code/plugin install motion2code@motion2code2Manually: put the files in place
.claude/rules/motion2code.mdThe paths frontmatter field limits the files: move applyTo from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/motion2code.mdcFrontmatter: description, globs, alwaysApply. Move applyTo from the source into globs, or the rule will not attach on its own
Manually: put the files in place
.devin/rules/motion2code.mdManually: put the files in place
.clinerules/motion2code.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about motion2code
How do I install motion2code in Claude Code?
Add the marketplace with /plugin marketplace add lovisdotio/motion2code, then install it with /plugin install motion2code@motion2code. Place the rule file at .claude/rules/motion2code.md.
What does motion2code do?
It specifies a rebuild of source video as one inline SVG controlled by a single GSAP 3 timeline. The rule also defines the window.anim API, query parameters for seeking and autoplay, and an exact return to the opening frame.
Which files does motion2code apply to?
It applies to index.html, compare.html, and site.html. The supplied checks are scripts/check_anim.py --runtime and scripts/frame_diff.py.
Source text
motion2code.instructions.md · MIT
---
applyTo: "**/index.html,**/compare.html,**/site.html"
---
Copy this file into your repository's `.github/instructions/`. For agent mode, also install the skill with
`gh skill install lovisdotio/motion2code motion2code`.
- Rebuild the source video as one inline SVG animated by a single GSAP 3 timeline; expose
`window.anim = { tl, duration, seek(t), play(from), pause() }` with `seek` a pure function of t.
- Support `?t=` (freeze), `?external=1` (no autoplay) and set `<html data-ready="1">` when ready.
- Use only the given source video (no regeneration, no `<img>`/`<video>`/raster in the page), the prompt's exact
words, flat sampled colors.
- The last moment returns to the exact opening frame. Check with `scripts/check_anim.py --runtime` and compare
with `scripts/frame_diff.py`.
© Lovis Odin · MIT · lovisdotio/motion2code
Similar IDE rules
IDE rules catalog →motion2code by other authors comes first.