Skip to main content
rule CX Codex

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

Install into GitHub Copilot · Manually: put the files in place All methods and platforms ↓
.github/instructions/motion2code.instructions.md
Open on GitHub

What 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.html from the source video as one inline SVG driven by GSAP 3.
  • Add window.anim controls and ?t= handling to compare.html.
  • Run scripts/check_anim.py --runtime and scripts/frame_diff.py for site.html.

How to install motion2code

Manually: put the files in place

.github/instructions/motion2code.instructions.md

The applyTo field sets which files it applies to

Step 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.

motion2code Lovis Odin The motion2code rule for Claude Code rebuilds motion design videos as SVG and GSAP code. It triggers during work on index, compare, site pages, and SVG files. CX Codex +1 ★ 361repo stars context-mode Mert Koseoğlu context-mode routes heavy tool outputs and web pages into an MCP sandbox so raw data does not clutter the agent context window. CX Codex +1 ★ 34,370repo stars context-mode Mert Koseoğlu This rule routes data work through context-mode MCP tools and keeps raw files out of the conversation. Use it for analysis, search, and transformations. CX Codex +1 ★ 34,370repo stars json-structured-prompting calesthio json-structured-prompting defines a JSON architecture for complex image prompts with multiple subjects, explicit positioning, and variable templates. CX Codex +1 ★ 78,316repo stars i2i-prompting calesthio i2i-prompting — a rule for writing image-to-image editing prompts with FLUX.2. Use it for targeted changes, style transfers, text edits, and staged transformations. CX Codex +1 ★ 78,316repo stars flux2-models calesthio Rule with prompting patterns for FLUX.2 models: klein, max, pro, flex, and dev. Shows the agent how to write generation and editing prompts for each variant. CX Codex +1 ★ 78,316repo stars model-selection-guide calesthio model-selection-guide — a decision rule that matches FLUX models to priorities: speed, quality, balance, typography, or image editing. Quick matrix and decision tree streamline the choice for each task. CX Codex +1 ★ 78,316repo stars

From the same set6

Project sponsors

Companies that keep this analytics open