lovisdotio/motion2code

Skills for coding agents: rebuild a motion design video as looping SVG + GSAP code, checked frame by frame against the source

What it solves

Coding agents often struggle to recreate motion design videos accurately because they cannot "see" the video. They frequently guess timing, colors, and motion, leading to animations that don't match the source, jump during loops, or rely on low-quality workarounds like embedding the video itself. This project provides a structured way for agents to study, rebuild, and verify animations as clean, editable code.

How it works

The project acts as a "skill" for AI coding agents. It uses a suite of Python scripts to break down a source video into data the agent can understand, such as frame-by-frame snapshots, color palettes, and timing markers. The agent then uses this data to write code—typically SVG shapes animated with GSAP—that follows a strict "page contract." This contract ensures the animation is seekable, deterministic, and perfectly synced. Finally, the agent uses automated tools to compare its code output against the original video, frame by frame, to ensure the result is an exact match.

Who it’s for

This tool is designed for developers and users of AI coding agents (such as Claude Code, Cursor, Copilot, or Gemini) who want to convert motion design videos or screen recordings into high-quality, interactive, and editable web code.

Highlights

  • Look before coding: Automatically extracts frames, palettes, and timing data from videos so agents have a clear reference.
  • Deterministic output: Uses a single GSAP timeline that allows for frame-by-frame seeking and testing.
  • Rigorous verification: Includes scripts to compare the generated code against the source video, providing a difference score to highlight inaccuracies.
  • Editable and scalable: Produces lightweight, resolution-independent SVG code that can be easily edited or scaled to any size (e.g., 4K or 8K).
  • Real-world utility: Can transform screen recordings into functional, interactive websites using GSAP ScrollTrigger.

Related

  • Project
  • Project
  • Project
  • Project