Communitygithub.com

itswenxin/motion-replicate

Use when the user pastes a Pinterest, Behance, Dribbble, Vimeo, YouTube or direct video link (or drops a video file) and wants the animation recreated in After Effects. Fetches or samples the reference, measures timing and motion, rebuilds it with editable keyframes, and compares frame by frame until it matches.

What is motion-replicate?

motion-replicate is a Claude Code agent skill that use when the user pastes a Pinterest, Behance, Dribbble, Vimeo, YouTube or direct video link (or drops a video file) and wants the animation recreated in After Effects. Fetches or samples the reference, measures timing and motion, rebuilds it with editable keyframes, and compares frame by frame until it matches.

Works with✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/itswenxin/motion-agent/tree/HEAD/agent-skills/motion-replicate

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Motion Replicate — from a reference link to an editable AE rebuild

Read skill/SKILL.md sections "复刻参考片失败的五个根因" and "复刻参考片:先逐帧量,再动手" first. The rule: measure before building. Every number in the rebuild comes from the reference.

1. Get the reference

python3 tools/fetch_reference.py "<link>" --slug <short-name>
  • Pinterest (pin.it or /pin//): downloads the pin's video through Pinterest's public widget API, including idea/story pins. If the pin is only an image, the tool says so and prints the outbound link: the real motion is usually there (an Instagram or Behance post). Follow it.
  • Direct video URL (.mp4/.mov/.webm/.gif): downloaded as is.
  • Behance, Vimeo, YouTube, portfolio sites: often refuse command-line requests (exit code 3) or embed a player. Then watch instead of download:
    1. Open the project page in the browser and list the players: [...document.querySelectorAll('iframe,video')].map(n => n.src || n.currentSrc).
    2. Open the player URL itself (e.g. https://player.vimeo.com/video/<id>), paste tools/browser_frame_sampler.js into the browser's JavaScript tool, run await motionAgentSample({ fps: 12 }), then screenshot: you get a timestamped contact sheet and per-frame motion energy. await motionAgentShowFrame(t) + screenshot gives one full-resolution frame for measuring positions.
    3. Save the screenshots and the returned JSON into refs/<slug>/.
  • Never bypass logins, paywalls or bot checks, and never spoof headers to pull protected files. If a page blocks you, use the browser route or ask the user to download the clip.

Everything under refs/ is git-ignored. Reference videos belong to their creators: never commit them or publish their frames; credit the creator (meta.json) in the case.

2. Measure

python3 tools/analyze_reference.py refs/<slug>/reference.mp4 --fps 24

Read refs/<slug>/ANALYSIS.md: size, frame rate, duration, holds, cuts, fastest moments, whether it loops, palette, plus a contact sheet and a motion-energy plot. Then measure each moving element from frames/ (pixel positions, scale, rotation at its start, end and turning points; tools/measure.py helps) and write a short spec: element → keys (time, value) → speed shape (ease in / out / both, overshoot).

Tell the user in 3–5 lines what you measured and how you will build it before building.

3. Rebuild in After Effects

  • Comp at the reference's size and frame rate (scale ×2 for small references, and say so).
  • Open the comp in the viewer and move the playhead while working, so the user can watch.
  • Keyframes with Bézier easing first (explicit speed/influence that reproduce the measured speed curve); expressions only when keyframes cannot do it.
  • One short word per comp and layer name.
  • Save a backup before each structural change.

4. Compare and iterate

Render the same timestamps as the reference frames and put them side by side:

python3 tools/sheet.py "<our frames glob>" refs/<slug>/compare.png --pair "refs/<slug>/frames/f_*.jpg"

Check timing (holds and cuts land on the same frames), positions (within a few pixels at the same scale), speed shape and colour. Fix the biggest mismatch first and compare again. Report each round with the comparison sheet. Stop when the user is happy.

5. Keep what was learned

When the user confirms the render, run agent-skills/motion-retrospective. The case credits the original creator and source link, includes only our own rebuild's frames, and records the measured numbers and the keyframes that reproduced them.

Individual skills in this repo

This repo contains 3 individual skills — each has its own dedicated page.

Related Skills