Motion2code 标志

Motion2code

社区
lovisdotio
motion2code

Rebuilds an AI-generated (or any) flat motion design video as clean, editable code: inline SVG shapes animated by one GSAP timeline, seekable frame by frame, looping seamlessly, checked side by side against the source; and optionally turns an interface recording into a real interactive website (GSAP ScrollTrigger, real clicks). Ships scripts to study the video (frames, cuts, contact sheet, exact palette), render the code to mp4/GIF through anim.seek, compare it with the source frame by frame and check the loop seam and page contract. Use when the user wants a video, GIF, Lottie-like clip, motion design shot, animated logo, UI screen recording or AI video "recreated in code", "converted to SVG/GSAP", "made into an HTML animation" or "made into a real site". Not for photographic footage, 3D rendering or video editing.

概览

发布者lovisdotio
代码仓库motion2code
技能名称motion2code
星标数
280
复刻数
26
附带文件
17
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载的 SKILL.md 文件,因此只有在请求确实匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 17 个随附文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 lovisdotio 发布于 GitHub。请在安装前查看源内容。

安装

在 TypingMind 中安装 Motion2code AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/lovisdotio/motion2code/tree/main/skills/motion2code
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/lovisdotio/motion2code.git /tmp/motion2code
mkdir -p .claude/skills
cp -r /tmp/motion2code/skills/motion2code .claude/skills/motion2code
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Motion2code,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Motion2code。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Motion2code 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会获取指令,因此未使用的技能不会产生额外费用。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Motion2Code

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.

Workflow

  1. Study the source. 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.
  2. Write the shot list. One line per beat: time range, what each shape does, how it eases, what it becomes next. Note the stage size (1920x1080 or 1080x1920) and the real duration (ffprobe, e.g. 15.10 s means a 15 s loop). See references/study-the-source.md.
  3. Build the stage from 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.
  4. Animate on one GSAP timeline. Tweens for the shots, plus a pure 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.
  5. Close the loop in code. The last moment returns to the exact opening frame, even when the source does not. See references/seamless-loop.md.
  6. Verify, fix, repeat. 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.
  7. Deliver: 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.
  8. Optional real site. For an interface recording, after the faithful replay, build 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.

The page contract

js
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.
  • Self-contained: inline SVG, GSAP 3 from cdnjs, flubber from jsdelivr only when a morph needs it, Google Fonts. Nothing else is loaded.

Hard rules

  • Use only the given source video. Never regenerate it, never fetch "a better version", never trace a frame into the page. No <img>, <video>, SVG <image>, canvas drawImage or raster data URI in the animation.
  • Words exactly as in the source prompt (or the video if there is no prompt), even when the video misspells them. Invented gibberish words in UI recordings become flat bars or are removed.
  • Flat shapes as SVG. Solid fills, the sampled hex colors, no gradients, shadows or filters the source does not have. Strokes with stroke-linecap="round" for sticker outlines.
  • GSAP timeline is the single clock. No requestAnimationFrame loops, setTimeout choreography, CSS animations or Date.now() driving visuals. Randomness is seeded and precomputed.
  • The loop is done in code. If the source does not return to its opening frame, add a short clean transition back to it. The seam is checked numerically.
  • Every moment is checked against the source side by side, at least every 0.5 s and frame by frame around every transition and the loop seam. "Looks right" without a pair image is not a check.
  • Same timing as the source. Measure from the frames; do not compress, pad or reorder beats.

Reference routing

Read only what the task needs:

FileRead when
references/study-the-source.mdstarting: frames, cuts, palette, shot list, words, duration, aspect
references/animation-architecture.mdbuilding: stage, shape origins, timeline vs draw(t), keyframe helper, morphs, fonts, determinism
references/motion-vocabulary.mdmatching the feel: snaps, squash and stretch, smears, elastic settles, iris wipes, morph chains
references/seamless-loop.mdthe source does not loop, or the seam jumps
references/verification.mdchecking and proof videos: frame_diff, compare.html, check_anim, render, side by side
references/interfaces-and-sites.mdthe 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).

Output expectations

  • Deliver 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.
  • List honestly what differs from the source (a simplified texture, a merged beat), never "pixel perfect".
  • Keep names readable: one group per character or object, ids that say what they are, the palette as constants, shots commented with their time range, so a designer can retime or recolor without reading everything.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Motion2code AI 技能有什么作用?

Rebuilds an AI-generated (or any) flat motion design video as clean, editable code: inline SVG shapes animated by one GSAP timeline, seekable frame by frame, looping seamlessly, checked side by side against the source; and optionally turns an interface recording into a real interactive website (GSAP ScrollTrigger, real clicks). Ships scripts to study the video (frames, cuts, contact sheet, exact palette), render the code to mp4/GIF through anim.seek, compare it with the source frame by frame and check the loop seam and page contract. Use when the user wants a video, GIF, Lottie-like clip, m...

为什么在 TypingMind 中使用 Motion2code?

因为您只需安装一次,就能搭配任何模型使用。Motion2code 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型,甚至可以在聊天中途切换模型,而不会影响技能正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Motion2code?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/lovisdotio/motion2code/tree/main/skills/motion2code。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Motion2code?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Motion2code 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以搭配 Motion2code 使用,包括 GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等,都可在 TypingMind 中使用您自己的 API 密钥接入。

Motion2code AI 技能免费吗?

是的。该技能源自 lovisdotio 在 GitHub 上以 MIT 许可证发布的项目。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇