# remotion-motion-graphics

Adopt this skill: https://proskills.md/skills/other/boriwatopal-agent-skill-remotion-motion-graphics-skills-remotion-motion-graphics

Page: https://proskills.md/skills/other/boriwatopal-agent-skill-remotion-motion-graphics-skills-remotion-motion-graphics
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/remotion-motion-graphics/SKILL.md
size: 9180
sha: 18db2c6b3feebc8ed6de2d1d6a4d0aa7e69d3c82
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/SKILL.md

````text
---
name: remotion-motion-graphics
description: Build kinetic-typography / logo / brand promo motion graphics as code with Remotion (React) and ship an MP4. Covers analysing a reference clip and the brand SVG logo, build a scene-per-beat project with reusable animation helpers, verify by contact sheet, output 9:16 and 16:9, tweak in Remotion Studio. Use this whenever the user wants a "motion", "motion graphics", "animated logo", "logo reveal", "kinetic text", "promo clip", "intro/outro", "Reels/TikTok/YouTube video" made from a brand, a website, an SVG, or "like this video" — including Thai asks such as "ทำ motion", "ทำโมชั่นโลโก้", "ทำคลิปโปรโมท", "อนิเมทโลโก้", "ทำวิดีโอแบบนี้" — and whenever Remotion code needs writing or fixing. Trigger even if they never say Remotion; if they hand over an .svg logo and a sample .mp4 and say "make one like this", this is the skill. (For a 6-scene product-demo built from a website's screenshots, product-demo-video is the narrower fit; for captioning talking-head clips use hyperframes-captioned-video.)
---

# Motion graphics with Remotion

Code-driven video: every frame is a React render of `useCurrentFrame()`, so
timing is exact, edits are cheap, and the same scenes can output any aspect
ratio. The craft is in three places: **reading the source material well**,
**a project skeleton that keeps timing and layout in one place**, and **a
verification loop that looks at real frames**. This file is the workflow;
the details live in `references/` and reusable code in `assets/` and
`scripts/`.

## 0. Ground rules from Remotion (read before writing scenes)
`references/remotion-rules/` holds the official rule files (animations,
timing, text-animations, sequencing, transitions, compositions, fonts,
images, charts, audio, sfx, videos, light-leaks). Load `animations.md`,
`timing.md` and `sequencing.md` every time; the rest when the piece needs
them. The non-negotiables they encode:
- All motion derives from `useCurrentFrame()`; write times in seconds × fps.
  CSS transitions/animations and Tailwind animation classes do not render.
- Entrances: `interpolate` + `Easing.bezier(0.16, 1, 0.3, 1)` (or `spring`
  with damping 10-15 when you want a visible bounce). Exits accelerate
  (`Easing.in`). Clamp everything.
- Typewriter = string slicing, never per-character opacity.
- `<Sequence premountFor>` / `<Series.Sequence premountFor>` so fonts and
  images are ready; `<Img>` (never `<img>`); `random("seed")` (never
  `Math.random`).
- The `remotion-best-practices` skill from `remotion-dev/skills` is the full
  source; install it with `npx skills add remotion-dev/skills` for topics
  not bundled here (captions, maps, 3D, Lottie, transparency).

## 1. Read the brief and the material (before any code)
1. **Reference clip** (if given): run `scripts/analyze_reference.sh <video> <dir>`
   and view every sheet. Write a beat map: for each 0.5-2 s beat note
   background (light/dark), what enters, how (rise, spring, wipe, type),
   what leaves, and the transition. This map becomes `SCENES` in theme.ts
   with one scene component per beat. Match its rhythm; you are cloning
   motion, not content.
2. **Brand**: fetch the site (`curl -sL -A "Mozilla/5.0" <url>`) for the
   tagline, product names, real numbers, and font (`grep -oi "inter\|prompt\|kanit"`),
   and the site CSS for colour tokens. If the site is neutral, take colours
   from the logo SVG fills (`grep -o 'fill="[^"]*"' logo.svg | sort | uniq -c`).
   Real copy beats invented copy; when you must invent lines, say so at
   the end.
3. **Artwork**: `node scripts/svg_to_paths.mjs --report logo.svg` prints
   every path's index, fill, position and size. Decide which indices are
   the wordmark letters, the character, the eyes, etc. (letters are usually
   same-fill, mid-sized, arranged along an arc or line; the big outline path
   is the body). Then `node scripts/svg_to_paths.mjs --out src/logo/paths.ts name=logo.svg`.
   Sort letter indices in reading order (along an arc: by angle around a
   point below the arc). Don't trust rsvg/quicklook previews on macOS;
   verify splits with a Remotion still.
4. Decide orientation(s) and length. Default 1080x1920 @ 30 fps for social;
   also produce 1920x1080 when asked for "horizontal" — the layout hook
   makes that a second `<Composition>`, not a second codebase.
5. Don't download assets from third-party hosts without asking; styled
   React cards with the real course/product names look on-brand and need
   no permission.

## 2. Scaffold and skeleton
```bash
npx create-video@latest --yes --blank --no-tailwind <name>
cd <name> && npm install && npx remotion add @remotion/google-fonts
```
Copy from `assets/` into `src/`:
- `theme.template.ts` → `theme.ts`: colours (`C`), `PORTRAIT`/`LANDSCAPE`,
  `SCENES` (named durations in frames, playback order), `TOTAL`.
- `layout.ts`: `useLayout()` → `{W,H,cx,cy,wide,diag,scale}` derived from
  `useVideoConfig()`. Every position in every scene comes from here
  (`cx - 218`, `H * 0.615`, `wide ? ... : ...`), never from literal 1080/1920.
  The wide version is designed at 1600x900 and scaled 1.2x in `Main`.
- `anim.ts`: `EASE_OUT/IN/INOUT/POP`, `prog(frame,start,dur,easing)`,
  `springAt(frame,fps,start,{damping,stiffness})`, `riseStyle`, `typed`.
- `fonts.ts`, `Main.template.tsx` → `Main.tsx` (Series + design-scale
  wrapper), `Root.template.tsx` → `Root.tsx` (two compositions).
- `components/Backgrounds.tsx` (LightBg with brand glow, DarkBg with glow),
  `components/Cursors.tsx` (arrow + dot), `components/Words.tsx`
  (word-by-word reveal with optional exit), `components/SvgArt.tsx`
  (animate SVG artwork per path: `parts` with `popEach` for letters,
  `characterStyle()` for bounce/bob/sway, `fadeLeft` for edge-cropped art).
Delete the scaffold's `Composition.tsx`. Keep inline styles.

One file per scene (`scenes/S01Hook.tsx` …), each an `<AbsoluteFill>` with
its own background so hard cuts are intentional. Local frames start at 0 in
every scene; timings live at the top of the file as small constants.

## 3. Write the scenes
`references/scene-patterns.md` is a catalogue of 16 patterns with timings
that worked (phrase swap, pill→button→click, flying collage, circle wipe,
ticker + panel wipe, shape hand-off between scenes, route drawing, UI
toggle moment, gradient statement, character + letter pop, bubble rows,
chart card, spotlight, burst → lockup, fade out). Pick the ones the beat map
calls for; reuse the shapes rather than inventing new mechanics per scene.
Guidelines that keep it looking designed:
- Few colours: ink, white, one brand accent, one secondary. Light scenes
  share one `LightBg`, dark scenes one `DarkBg`, so cuts don't flash.
- Type: headline 58-80 px, labels ≥ 28 px at 1080 wide; weight 600-700;
  letter-spacing −0.5 to −1.2 on big lines.
- Stagger words 5-7 frames; entrances 12-16 frames; exits 8-10 frames;
  a beat holds ≥ 20 frames after its last element lands.
- Hand elements between scenes (pill → marker, button position → next
  scene's start) through shared helpers so the cut is invisible.
- Characters: spring in from below (damping 12), then bob + 2-3° sway;
  pop wordmark letters 2 frames apart with damping 10.
- Anything positional uses fractions of W/H or offsets from cx/cy, with a
  `wide` branch when a tall element must sit beside its text.

## 4. Verify like an editor, not a compiler
`references/verification-and-gotchas.md` has the loop and the traps. Short
form: `npx tsc --noEmit` → `scripts/check_render.sh <CompId> out/check` →
view every contact sheet → still-render suspicious frames at 0.5 → fix →
repeat. Only then `npx remotion render <CompId> out/final.mp4 --codec=h264 --crf=18`,
and pull a frame or two from the final file as proof. When adding a second
orientation, re-check the first one's sheet to prove nothing moved.

## 5. Deliver
- Copy the MP4 next to the user's source files and send it with the file
  tool (`SendUserFile`), one card per meaningful version.
- Start Remotion Studio for scrubbing/tweaking: `.claude/launch.json` at the
  session root with `sh -c "cd <project> && npx remotion studio --port 3011 --no-open"`,
  then `preview_start`. Mention the composition ids.
- In the summary: what each scene does in one line, which copy lines were
  invented, what was not done (no music, no downloaded photos), and the
  one-line re-render command.

## Files
- `assets/` — theme, layout hook, anim helpers, fonts, Main/Root templates,
  Backgrounds, Cursors, Words, SvgArt (copy into `src/`).
- `scripts/analyze_reference.sh` — contact sheets from a reference video.
- `scripts/svg_to_paths.mjs` — SVG → TS path data with bbox report.
- `scripts/check_render.sh` — low-res render + sheets for a composition.
- `scripts/still_frame.sh` — one frame from an MP4 at a timestamp.
- `references/scene-patterns.md` — the pattern catalogue with timings.
- `references/verification-and-gotchas.md` — check loop and traps.
- `references/remotion-rules/` — official Remotion rule files.
````

## File: skills/remotion-motion-graphics/scripts/analyze_reference.sh
size: 1100
sha: 60cc88a6aa47b71b3608d0c574372d9d421d6b8f
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/scripts/analyze_reference.sh

```text
#!/usr/bin/env bash
# Break a reference video into contact sheets so its motion can be mapped beat
# by beat (backgrounds, cuts, text timing, transitions) before writing scenes.
#
# Usage: analyze_reference.sh <video> <out_dir>
# Produces: <out_dir>/overview.png (1 fps, whole video) and
#           <out_dir>/seg_<start>s.png (4 fps, 8-second windows, 32 frames each)
set -euo pipefail
VIDEO="$1"; OUT="$2"; mkdir -p "$OUT"
ffprobe -v error -show_entries format=duration:stream=width,height,r_frame_rate -of default=noprint_wrappers=1 "$VIDEO" | tee "$OUT/probe.txt"
DUR=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$VIDEO" | cut -d. -f1)
COLS=6; ROWS=$(( (DUR + COLS) / COLS ))
ffmpeg -v error -y -i "$VIDEO" -vf "fps=1,scale=180:-1,tile=${COLS}x${ROWS}" "$OUT/overview.png"
START=0
while [ "$START" -lt "$DUR" ]; do
  ffmpeg -v error -y -ss "$START" -t 8 -i "$VIDEO" -vf "fps=4,scale=160:-1,tile=8x4" "$OUT/seg_${START}s.png"
  START=$((START + 8))
done
echo "wrote $(ls "$OUT"/*.png | wc -l | tr -d ' ') sheets to $OUT — read them with the image viewer and write the beat map"
```

## File: skills/remotion-motion-graphics/scripts/check_render.sh
size: 951
sha: 5d91244b8f3608e62715e1730176196b3e353904
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/scripts/check_render.sh

```text
#!/usr/bin/env bash
# Cheap whole-composition check: render at 0.3 scale, tile frames into contact
# sheets, and print the paths to view. Catches crashes, overlaps, safe-zone
# misses and timing problems in ~1 minute instead of a full render.
#
# Usage: check_render.sh <composition-id> <out_dir> [sheet_seconds=12] [fps=2]
# Run from inside the Remotion project.
set -euo pipefail
COMP="$1"; OUT="$2"; SEG="${3:-12}"; FPS="${4:-2}"; mkdir -p "$OUT"
npx remotion render "$COMP" "$OUT/preview_${COMP}.mp4" --scale=0.3 --jpeg-quality=70 --log=error 2>&1 | grep -v -i deprecat || true
DUR=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$OUT/preview_${COMP}.mp4" | cut -d. -f1)
START=0; N=1
while [ "$START" -le "$DUR" ]; do
  ffmpeg -v error -y -ss "$START" -t "$SEG" -i "$OUT/preview_${COMP}.mp4" -vf "fps=${FPS},scale=200:-1,tile=8x3" "$OUT/${COMP}_sheet${N}.png"
  START=$((START + SEG)); N=$((N + 1))
done
ls "$OUT"/${COMP}_sheet*.png
```

## File: skills/remotion-motion-graphics/scripts/still_frame.sh
size: 277
sha: 715692420c6c71a6698b5820ad2700e8b2d1544a
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/scripts/still_frame.sh

```text
#!/usr/bin/env bash
# Extract one frame from a rendered MP4 at a timestamp (seconds) for a
# close-up check of a single moment. Usage: still_frame.sh <mp4> <seconds> <out.png>
set -euo pipefail
ffmpeg -v error -y -ss "$2" -i "$1" -frames:v 1 -vf scale=960:-1 "$3" && echo "$3"
```

## File: skills/remotion-motion-graphics/scripts/svg_to_paths.mjs
size: 3643
sha: 07540b1e104a4e1ea4f48da3aee3eacce7a25ad8
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/scripts/svg_to_paths.mjs

```text
#!/usr/bin/env node
// Turn one or more SVG files into a TypeScript module of path data + bounding
// boxes, so artwork can be animated per path in Remotion (see SvgArt.tsx).
//
//   node svg_to_paths.mjs --out src/logo/paths.ts dog=logo-dog.svg lemon=logo-lemon.svg
//   node svg_to_paths.mjs --report logo-dog.svg          # print a bbox table only
//
// The report lists every path's index, fill, position and size. Use it to
// decide which indices form which part (wordmark letters, body, eyes...).
// Gradient fills (url(#id)) are replaced by their first stop colour, or grey.
import fs from "node:fs";

const args = process.argv.slice(2);
let out = null;
let report = false;
const inputs = [];
for (let i = 0; i < args.length; i++) {
  if (args[i] === "--out") out = args[++i];
  else if (args[i] === "--report") report = true;
  else inputs.push(args[i]);
}
if (inputs.length === 0) {
  console.error("usage: svg_to_paths.mjs [--out file.ts] [--report] name=file.svg ...");
  process.exit(1);
}

const parse = (file) => {
  const s = fs.readFileSync(file, "utf8");
  const stops = {};
  for (const g of s.matchAll(/<(linearGradient|radialGradient)[^>]*id="([^"]+)"[^>]*>([\s\S]*?)<\/\1>/g)) {
    const m = g[3].match(/stop-color="([^"]+)"|stop-color:\s*([^;"]+)/);
    stops[g[2]] = m ? m[1] || m[2] : "#9A9AA8";
  }
  const other = s.match(/<(rect|circle|ellipse|polygon|polyline|line|use|image|text)\b/g);
  if (other) console.warn(`${file}: contains ${[...new Set(other)].join(", ")} — only <path> elements are exported; convert shapes to paths in the editor if they matter`);
  const paths = [];
  for (const m of s.matchAll(/<path\b([^>]*)\/?>/g)) {
    const attrs = m[1];
    const d = attrs.match(/\sd="([^"]+)"/)?.[1];
    if (!d) continue;
    let fill = attrs.match(/\sfill="([^"]+)"/)?.[1] ?? "#000000";
    if (fill === "white") fill = "#FFFFFF";
    if (fill === "black") fill = "#000000";
    const grad = fill.match(/url\(#([^)]+)\)/);
    if (grad) fill = stops[grad[1]] ?? "#9A9AA8";
    const nums = d.match(/-?\d*\.?\d+(?:e-?\d+)?/g).map(Number);
    const xs = [], ys = [];
    for (let k = 0; k + 1 < nums.length; k += 2) { xs.push(nums[k]); ys.push(nums[k + 1]); }
    const box = [Math.min(...xs), Math.min(...ys), Math.max(...xs), Math.max(...ys)].map(Math.round);
    paths.push({ d, fill, box });
  }
  const box = [
    Math.min(...paths.map((p) => p.box[0])), Math.min(...paths.map((p) => p.box[1])),
    Math.max(...paths.map((p) => p.box[2])), Math.max(...paths.map((p) => p.box[3])),
  ];
  return { box, paths };
};

let ts = "// AUTO-GENERATED by svg_to_paths.mjs — do not edit by hand.\n";
ts += "export type SvgPath = { d: string; fill: string; box: [number, number, number, number] };\n";
ts += "export type SvgData = { box: [number, number, number, number]; paths: SvgPath[] };\n";
for (const input of inputs) {
  const eq = input.indexOf("=");
  const name = eq > 0 ? input.slice(0, eq) : input.replace(/.*\//, "").replace(/\W.*$/, "");
  const file = eq > 0 ? input.slice(eq + 1) : input;
  const data = parse(file);
  console.error(`${name}: ${data.paths.length} paths, art box ${data.box.join(",")}`);
  if (report || !out) {
    console.log(`\n=== ${name} (${file})\nidx\tfill\tx,y\tw x h`);
    data.paths.forEach((p, i) => console.log(`${i}\t${p.fill}\t${p.box[0]},${p.box[1]}\t${p.box[2] - p.box[0]}x${p.box[3] - p.box[1]}`));
  }
  ts += `\nexport const ${name}: SvgData = ${JSON.stringify(data)};\n`;
}
if (out) {
  fs.mkdirSync(out.replace(/\/[^/]+$/, ""), { recursive: true });
  fs.writeFileSync(out, ts);
  console.error(`wrote ${out} (${(ts.length / 1024).toFixed(0)} KB)`);
}
```

## File: skills/remotion-motion-graphics/references/remotion-rules/animations.md
size: 1089
sha: 4a02e553570e570e45319112626adb214a39b025
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/animations.md

````text
---
name: animations
description: Fundamental animation skills for Remotion
metadata:
  tags: animations, transitions, frames, useCurrentFrame
---

All animations MUST be driven by the `useCurrentFrame()` hook.  
Write animations in seconds and multiply them by the `fps` value from `useVideoConfig()`.

For eased motion, prefer `interpolate` with explicit frame ranges and an easing—especially `Easing.bezier`, which matches CSS `cubic-bezier` so timing can be shared with web specs and curve editors. See [timing](./timing.md).

```tsx
import { useCurrentFrame, Easing } from "remotion";

export const FadeIn = () => {
  const frame = useCurrentFrame();
  const { fps } = useVideoConfig();

  const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {
    extrapolateRight: "clamp",
    extrapolateLeft: "clamp",
    easing: Easing.bezier(0.16, 1, 0.3, 1),
  });

  return <div style={{ opacity }}>Hello World!</div>;
};
```

CSS transitions or animations are FORBIDDEN - they will not render correctly.  
Tailwind animation class names are FORBIDDEN - they will not render correctly.
````

## File: skills/remotion-motion-graphics/references/remotion-rules/audio.md
size: 3625
sha: 1097c70e864a1ab88ad853de4cf77ff74232653d
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/audio.md

````text
---
name: audio
description: Using audio and sound in Remotion - importing, trimming, volume, speed, pitch
metadata:
  tags: audio, media, trim, volume, speed, loop, pitch, mute, sound, sfx
---

# Using audio in Remotion

## Prerequisites

First, the @remotion/media package needs to be installed.
If it is not installed, use the following command:

```bash
npx remotion add @remotion/media
```

## Importing Audio

Use `<Audio>` from `@remotion/media` to add audio to your composition.

```tsx
import { Audio } from "@remotion/media";
import { staticFile } from "remotion";

export const MyComposition = () => {
  return <Audio src={staticFile("audio.mp3")} />;
};
```

Remote URLs are also supported:

```tsx
<Audio src="https://remotion.media/audio.mp3" />
```

By default, audio plays from the start, at full volume and full length.
Multiple audio tracks can be layered by adding multiple `<Audio>` components.

## Trimming

Use `trimBefore` and `trimAfter` to remove portions of the audio. Values are in frames.

```tsx
const { fps } = useVideoConfig();

return (
  <Audio
    src={staticFile("audio.mp3")}
    trimBefore={2 * fps} // Skip the first 2 seconds
    trimAfter={10 * fps} // End at the 10 second mark
  />
);
```

The audio still starts playing at the beginning of the composition - only the specified portion is played.

## Delaying

Wrap the audio in a `<Sequence>` to delay when it starts:

```tsx
import { Sequence, staticFile } from "remotion";
import { Audio } from "@remotion/media";

const { fps } = useVideoConfig();

return (
  <Sequence from={1 * fps}>
    <Audio src={staticFile("audio.mp3")} />
  </Sequence>
);
```

The audio will start playing after 1 second.

## Volume

Set a static volume (0 to 1):

```tsx
<Audio src={staticFile("audio.mp3")} volume={0.5} />
```

Or use a callback for dynamic volume based on the current frame:

```tsx
import { interpolate } from "remotion";

const { fps } = useVideoConfig();

return (
  <Audio
    src={staticFile("audio.mp3")}
    volume={(f) =>
      interpolate(f, [0, 1 * fps], [0, 1], { extrapolateRight: "clamp" })
    }
  />
);
```

The value of `f` starts at 0 when the audio begins to play, not the composition frame.

## Muting

Use `muted` to silence the audio. It can be set dynamically:

```tsx
const frame = useCurrentFrame();
const { fps } = useVideoConfig();

return (
  <Audio
    src={staticFile("audio.mp3")}
    muted={frame >= 2 * fps && frame <= 4 * fps} // Mute between 2s and 4s
  />
);
```

## Speed

Use `playbackRate` to change the playback speed:

```tsx
<Audio src={staticFile("audio.mp3")} playbackRate={2} /> {/* 2x speed */}
<Audio src={staticFile("audio.mp3")} playbackRate={0.5} /> {/* Half speed */}
```

Reverse playback is not supported.

## Looping

Use `loop` to loop the audio indefinitely:

```tsx
<Audio src={staticFile("audio.mp3")} loop />
```

Use `loopVolumeCurveBehavior` to control how the frame count behaves when looping:

- `"repeat"`: Frame count resets to 0 each loop (default)
- `"extend"`: Frame count continues incrementing

```tsx
<Audio
  src={staticFile("audio.mp3")}
  loop
  loopVolumeCurveBehavior="extend"
  volume={(f) => interpolate(f, [0, 300], [1, 0])} // Fade out over multiple loops
/>
```

## Pitch

Use `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2:

```tsx
<Audio
  src={staticFile("audio.mp3")}
  toneFrequency={1.5} // Higher pitch
/>
<Audio
  src={staticFile("audio.mp3")}
  toneFrequency={0.8} // Lower pitch
/>
```

Pitch shifting only works during server-side rendering, not in the Remotion Studio preview or in the `<Player />`.
````

## File: skills/remotion-motion-graphics/references/remotion-rules/charts.md
size: 2942
sha: f03648589241141e2ad109c6caad3fae5d5e666c
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/charts.md

````text
---
name: charts
description: Chart and data visualization patterns for Remotion. Use when creating bar charts, pie charts, line charts, stock graphs, or any data-driven animations.
metadata:
  tags: charts, data, visualization, bar-chart, pie-chart, line-chart, stock-chart, svg-paths, graphs
---

# Charts in Remotion

Create charts using React code - HTML, SVG, and D3.js are all supported.

Disable all animations from third party libraries - they cause flickering.  
Drive all animations from `useCurrentFrame()`.

## Bar Chart

```tsx
const STAGGER_DELAY = 5;
const frame = useCurrentFrame();
const { fps } = useVideoConfig();

const bars = data.map((item, i) => {
  const height = spring({
    frame,
    fps,
    delay: i * STAGGER_DELAY,
    config: { damping: 200 },
  });
  return <div style={{ height: height * item.value }} />;
});
```

## Pie Chart

Animate segments using stroke-dashoffset, starting from 12 o'clock:

```tsx
const progress = interpolate(frame, [0, 100], [0, 1]);
const circumference = 2 * Math.PI * radius;
const segmentLength = (value / total) * circumference;
const offset = interpolate(progress, [0, 1], [segmentLength, 0]);

<circle
  r={radius}
  cx={center}
  cy={center}
  fill="none"
  stroke={color}
  strokeWidth={strokeWidth}
  strokeDasharray={`${segmentLength} ${circumference}`}
  strokeDashoffset={offset}
  transform={`rotate(-90 ${center} ${center})`}
/>;
```

## Line Chart / Path Animation

Use `@remotion/paths` for animating SVG paths (line charts, stock graphs, signatures).

Install: `npx remotion add @remotion/paths`  
Docs: https://remotion.dev/docs/paths.md

### Convert data points to SVG path

```tsx
type Point = { x: number; y: number };

const generateLinePath = (points: Point[]): string => {
  if (points.length < 2) return "";
  return points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
};
```

### Draw path with animation

```tsx
import { evolvePath } from "@remotion/paths";

const path = "M 100 200 L 200 150 L 300 180 L 400 100";
const progress = interpolate(frame, [0, 2 * fps], [0, 1], {
  extrapolateLeft: "clamp",
  extrapolateRight: "clamp",
  easing: Easing.out(Easing.quad),
});

const { strokeDasharray, strokeDashoffset } = evolvePath(progress, path);

<path
  d={path}
  fill="none"
  stroke="#FF3232"
  strokeWidth={4}
  strokeDasharray={strokeDasharray}
  strokeDashoffset={strokeDashoffset}
/>;
```

### Follow path with marker/arrow

```tsx
import {
  getLength,
  getPointAtLength,
  getTangentAtLength,
} from "@remotion/paths";

const pathLength = getLength(path);
const point = getPointAtLength(path, progress * pathLength);
const tangent = getTangentAtLength(path, progress * pathLength);
const angle = Math.atan2(tangent.y, tangent.x);

<g
  style={{
    transform: `translate(${point.x}px, ${point.y}px) rotate(${angle}rad)`,
    transformOrigin: "0 0",
  }}
>
  <polygon points="0,0 -20,-10 -20,10" fill="#FF3232" />
</g>;
```
````

## File: skills/remotion-motion-graphics/references/remotion-rules/compositions.md
size: 3794
sha: 0db5f60266d1612629ada17cc65d595a502fd0c6
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/compositions.md

````text
---
name: compositions
description: Defining compositions, stills, folders, default props and dynamic metadata
metadata:
  tags: composition, still, folder, props, metadata
---

A `<Composition>` defines the component, width, height, fps and duration of a renderable video.

It normally is placed in the `src/Root.tsx` file.

```tsx
import { Composition } from "remotion";
import { MyComposition } from "./MyComposition";

export const RemotionRoot = () => {
  return (
    <Composition
      id="MyComposition"
      component={MyComposition}
      durationInFrames={100}
      fps={30}
      width={1080}
      height={1080}
    />
  );
};
```

## Default Props

Pass `defaultProps` to provide initial values for your component.  
Values must be JSON-serializable (`Date`, `Map`, `Set`, and `staticFile()` are supported).

```tsx
import { Composition } from "remotion";
import { MyComposition, MyCompositionProps } from "./MyComposition";

export const RemotionRoot = () => {
  return (
    <Composition
      id="MyComposition"
      component={MyComposition}
      durationInFrames={100}
      fps={30}
      width={1080}
      height={1080}
      defaultProps={
        {
          title: "Hello World",
          color: "#ff0000",
        } satisfies MyCompositionProps
      }
    />
  );
};
```

Use `type` declarations for props rather than `interface` to ensure `defaultProps` type safety.

## Folders

Use `<Folder>` to organize compositions in the sidebar.  
Folder names can only contain letters, numbers, and hyphens.

```tsx
import { Composition, Folder } from "remotion";

export const RemotionRoot = () => {
  return (
    <>
      <Folder name="Marketing">
        <Composition id="Promo" /* ... */ />
        <Composition id="Ad" /* ... */ />
      </Folder>
      <Folder name="Social">
        <Folder name="Instagram">
          <Composition id="Story" /* ... */ />
          <Composition id="Reel" /* ... */ />
        </Folder>
      </Folder>
    </>
  );
};
```

## Stills

Use `<Still>` for single-frame images. It does not require `durationInFrames` or `fps`.

```tsx
import { Still } from "remotion";
import { Thumbnail } from "./Thumbnail";

export const RemotionRoot = () => {
  return (
    <Still id="Thumbnail" component={Thumbnail} width={1280} height={720} />
  );
};
```

## Calculate Metadata

Use `calculateMetadata` to make dimensions, duration, or props dynamic based on data.

```tsx
import { Composition, CalculateMetadataFunction } from "remotion";
import { MyComposition, MyCompositionProps } from "./MyComposition";

const calculateMetadata: CalculateMetadataFunction<
  MyCompositionProps
> = async ({ props, abortSignal }) => {
  const data = await fetch(`https://api.example.com/video/${props.videoId}`, {
    signal: abortSignal,
  }).then((res) => res.json());

  return {
    durationInFrames: Math.ceil(data.duration * 30),
    props: {
      ...props,
      videoUrl: data.url,
    },
  };
};

export const RemotionRoot = () => {
  return (
    <Composition
      id="MyComposition"
      component={MyComposition}
      durationInFrames={100} // Placeholder, will be overridden
      fps={30}
      width={1080}
      height={1080}
      defaultProps={{ videoId: "abc123" }}
      calculateMetadata={calculateMetadata}
    />
  );
};
```

The function can return `props`, `durationInFrames`, `width`, `height`, `fps`, and codec-related defaults. It runs once before rendering begins.

## Nesting compositions within another

To add a composition within another composition, you can use the `<Sequence>` component with a `width` and `height` prop to specify the size of the composition.

```tsx
<AbsoluteFill>
  <Sequence width={COMPOSITION_WIDTH} height={COMPOSITION_HEIGHT}>
    <CompositionComponent />
  </Sequence>
</AbsoluteFill>
```
````

## File: skills/remotion-motion-graphics/references/remotion-rules/fonts.md
size: 3484
sha: c10cd83e62491fe67df7dd4b2e9f8ea662e6ed30
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/fonts.md

````text
---
name: fonts
description: Loading Google Fonts and local fonts in Remotion
metadata:
  tags: fonts, google-fonts, typography, text
---

# Using fonts in Remotion

## Google Fonts with @remotion/google-fonts

The recommended way to use Google Fonts. It's type-safe and automatically blocks rendering until the font is ready.

### Prerequisites

First, the @remotion/google-fonts package needs to be installed.
If it is not installed, use the following command:

```bash
npx remotion add @remotion/google-fonts # If project uses npm
bunx remotion add @remotion/google-fonts # If project uses bun
yarn remotion add @remotion/google-fonts # If project uses yarn
pnpm exec remotion add @remotion/google-fonts # If project uses pnpm
```

```tsx
import { loadFont } from "@remotion/google-fonts/Lobster";

const { fontFamily } = loadFont();

export const MyComposition = () => {
  return <div style={{ fontFamily }}>Hello World</div>;
};
```

Preferrably, specify only needed weights and subsets to reduce file size:

```tsx
import { loadFont } from "@remotion/google-fonts/Roboto";

const { fontFamily } = loadFont("normal", {
  weights: ["400", "700"],
  subsets: ["latin"],
});
```

### Waiting for font to load

Use `waitUntilDone()` if you need to know when the font is ready:

```tsx
import { loadFont } from "@remotion/google-fonts/Lobster";

const { fontFamily, waitUntilDone } = loadFont();

await waitUntilDone();
```

## Local fonts with @remotion/fonts

For local font files, use the `@remotion/fonts` package.

### Prerequisites

First, install @remotion/fonts:

```bash
npx remotion add @remotion/fonts # If project uses npm
bunx remotion add @remotion/fonts # If project uses bun
yarn remotion add @remotion/fonts # If project uses yarn
pnpm exec remotion add @remotion/fonts # If project uses pnpm
```

### Loading a local font

Place your font file in the `public/` folder and use `loadFont()`:

```tsx
import { loadFont } from "@remotion/fonts";
import { staticFile } from "remotion";

await loadFont({
  family: "MyFont",
  url: staticFile("MyFont-Regular.woff2"),
});

export const MyComposition = () => {
  return <div style={{ fontFamily: "MyFont" }}>Hello World</div>;
};
```

### Loading multiple weights

Load each weight separately with the same family name:

```tsx
import { loadFont } from "@remotion/fonts";
import { staticFile } from "remotion";

await Promise.all([
  loadFont({
    family: "Inter",
    url: staticFile("Inter-Regular.woff2"),
    weight: "400",
  }),
  loadFont({
    family: "Inter",
    url: staticFile("Inter-Bold.woff2"),
    weight: "700",
  }),
]);
```

### Available options

```tsx
loadFont({
  family: "MyFont", // Required: name to use in CSS
  url: staticFile("font.woff2"), // Required: font file URL
  format: "woff2", // Optional: auto-detected from extension
  weight: "400", // Optional: font weight
  style: "normal", // Optional: normal or italic
  display: "block", // Optional: font-display behavior
});
```

## Using in components

Call `loadFont()` at the top level of your component or in a separate file that's imported early:

```tsx
import { loadFont } from "@remotion/google-fonts/Montserrat";

const { fontFamily } = loadFont("normal", {
  weights: ["400", "700"],
  subsets: ["latin"],
});

export const Title: React.FC<{ text: string }> = ({ text }) => {
  return (
    <h1
      style={{
        fontFamily,
        fontSize: 80,
        fontWeight: "bold",
      }}
    >
      {text}
    </h1>
  );
};
```
````

## File: skills/remotion-motion-graphics/references/remotion-rules/images.md
size: 2791
sha: 3b0319442f8bf23f8d740a945a65e70a46f59dff
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/images.md

````text
---
name: images
description: Embedding images in Remotion using the <Img> component
metadata:
  tags: images, img, staticFile, png, jpg, svg, webp
---

# Using images in Remotion

## The `<Img>` component

Always use the `<Img>` component from `remotion` to display images:

```tsx
import { Img, staticFile } from "remotion";

export const MyComposition = () => {
  return <Img src={staticFile("photo.png")} />;
};
```

## Important restrictions

**You MUST use the `<Img>` component from `remotion`.** Do not use:

- Native HTML `<img>` elements
- Next.js `<Image>` component
- CSS `background-image`

The `<Img>` component ensures images are fully loaded before rendering, preventing flickering and blank frames during video export.

## Local images with staticFile()

Place images in the `public/` folder and use `staticFile()` to reference them:

```
my-video/
├─ public/
│  ├─ logo.png
│  ├─ avatar.jpg
│  └─ icon.svg
├─ src/
├─ package.json
```

```tsx
import { Img, staticFile } from "remotion";

<Img src={staticFile("logo.png")} />;
```

## Remote images

Remote URLs can be used directly without `staticFile()`:

```tsx
<Img src="https://example.com/image.png" />
```

Ensure remote images have CORS enabled.

For animated GIFs, use the `<Gif>` component from `@remotion/gif` instead.

## Sizing and positioning

Use the `style` prop to control size and position:

```tsx
<Img
  src={staticFile("photo.png")}
  style={{
    width: 500,
    height: 300,
    position: "absolute",
    top: 100,
    left: 50,
    objectFit: "cover",
  }}
/>
```

## Dynamic image paths

Use template literals for dynamic file references:

```tsx
import { Img, staticFile, useCurrentFrame } from "remotion";

const frame = useCurrentFrame();

// Image sequence
<Img src={staticFile(`frames/frame${frame}.png`)} />

// Selecting based on props
<Img src={staticFile(`avatars/${props.userId}.png`)} />

// Conditional images
<Img src={staticFile(`icons/${isActive ? "active" : "inactive"}.svg`)} />
```

This pattern is useful for:

- Image sequences (frame-by-frame animations)
- User-specific avatars or profile images
- Theme-based icons
- State-dependent graphics

## Getting image dimensions

Use `getImageDimensions()` to get the dimensions of an image:

```tsx
import { getImageDimensions, staticFile } from "remotion";

const { width, height } = await getImageDimensions(staticFile("photo.png"));
```

This is useful for calculating aspect ratios or sizing compositions:

```tsx
import {
  getImageDimensions,
  staticFile,
  CalculateMetadataFunction,
} from "remotion";

const calculateMetadata: CalculateMetadataFunction = async () => {
  const { width, height } = await getImageDimensions(staticFile("photo.png"));
  return {
    width,
    height,
  };
};
```
````

## File: skills/remotion-motion-graphics/references/remotion-rules/light-leaks.md
size: 2305
sha: 354b95666ae975fea494191dc8042ac6c2aba48f
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/light-leaks.md

````text
---
name: light-leaks
description: Light leak overlay effects for Remotion using @remotion/light-leaks.
metadata:
  tags: light-leaks, overlays, effects, transitions
---

## Light Leaks

This only works from Remotion 4.0.415 and up. Use `npx remotion versions` to check your Remotion version and `npx remotion upgrade` to upgrade your Remotion version.

`<LightLeak>` from `@remotion/light-leaks` renders a WebGL-based light leak effect. It reveals during the first half of its duration and retracts during the second half.

Typically used inside a `<TransitionSeries.Overlay>` to play over the cut point between two scenes. See the **transitions** rule for `<TransitionSeries>` and overlay usage.

## Prerequisites

```bash
npx remotion add @remotion/light-leaks
```

## Basic usage with TransitionSeries

```tsx
import { TransitionSeries } from "@remotion/transitions";
import { LightLeak } from "@remotion/light-leaks";

<TransitionSeries>
  <TransitionSeries.Sequence durationInFrames={60}>
    <SceneA />
  </TransitionSeries.Sequence>
  <TransitionSeries.Overlay durationInFrames={30}>
    <LightLeak />
  </TransitionSeries.Overlay>
  <TransitionSeries.Sequence durationInFrames={60}>
    <SceneB />
  </TransitionSeries.Sequence>
</TransitionSeries>;
```

## Props

- `durationInFrames?` — defaults to the parent sequence/composition duration. The effect reveals during the first half and retracts during the second half.
- `seed?` — determines the shape of the light leak pattern. Different seeds produce different patterns. Default: `0`.
- `hueShift?` — rotates the hue in degrees (`0`–`360`). Default: `0` (yellow-to-orange). `120` = green, `240` = blue.

## Customizing the look

```tsx
import { LightLeak } from "@remotion/light-leaks";

// Blue-tinted light leak with a different pattern
<LightLeak seed={5} hueShift={240} />;

// Green-tinted light leak
<LightLeak seed={2} hueShift={120} />;
```

## Standalone usage

`<LightLeak>` can also be used outside of `<TransitionSeries>`, for example as a decorative overlay in any composition:

```tsx
import { AbsoluteFill } from "remotion";
import { LightLeak } from "@remotion/light-leaks";

const MyComp: React.FC = () => (
  <AbsoluteFill>
    <MyContent />
    <LightLeak durationInFrames={60} seed={3} />
  </AbsoluteFill>
);
```
````

## File: skills/remotion-motion-graphics/references/remotion-rules/sequencing.md
size: 2746
sha: 46b86a8872a7c7584dbe135f78d2e2fc04a536bd
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/sequencing.md

````text
---
name: sequencing
description: Sequencing patterns for Remotion - delay, trim, limit duration of items
metadata:
  tags: sequence, series, timing, delay, trim
---

Use `<Sequence>` to delay when an element appears in the timeline.

```tsx
import { Sequence } from "remotion";

const {fps} = useVideoConfig();

<Sequence from={1 * fps} durationInFrames={2 * fps} premountFor={1 * fps}>
  <Title />
</Sequence>
<Sequence from={2 * fps} durationInFrames={2 * fps} premountFor={1 * fps}>
  <Subtitle />
</Sequence>
```

This will by default wrap the component in an absolute fill element.  
If the items should not be wrapped, use the `layout` prop:

```tsx
<Sequence layout="none">
  <Title />
</Sequence>
```

## Premounting

This loads the component in the timeline before it is actually played.  
Always premount any `<Sequence>`!

```tsx
<Sequence premountFor={1 * fps}>
  <Title />
</Sequence>
```

## Series

Use `<Series>` when elements should play one after another without overlap.

```tsx
import { Series } from "remotion";

<Series>
  <Series.Sequence durationInFrames={45}>
    <Intro />
  </Series.Sequence>
  <Series.Sequence durationInFrames={60}>
    <MainContent />
  </Series.Sequence>
  <Series.Sequence durationInFrames={30}>
    <Outro />
  </Series.Sequence>
</Series>;
```

Same as with `<Sequence>`, the items will be wrapped in an absolute fill element by default when using `<Series.Sequence>`, unless the `layout` prop is set to `none`.

### Series with overlaps

Use negative offset for overlapping sequences:

```tsx
<Series>
  <Series.Sequence durationInFrames={60}>
    <SceneA />
  </Series.Sequence>
  <Series.Sequence offset={-15} durationInFrames={60}>
    {/* Starts 15 frames before SceneA ends */}
    <SceneB />
  </Series.Sequence>
</Series>
```

## Frame References Inside Sequences

Inside a Sequence, `useCurrentFrame()` returns the local frame (starting from 0):

```tsx
<Sequence from={60} durationInFrames={30}>
  <MyComponent />
  {/* Inside MyComponent, useCurrentFrame() returns 0-29, not 60-89 */}
</Sequence>
```

## Nested Sequences

Sequences can be nested for complex timing:

```tsx
<Sequence from={0} durationInFrames={120}>
  <Background />
  <Sequence from={15} durationInFrames={90} layout="none">
    <Title />
  </Sequence>
  <Sequence from={45} durationInFrames={60} layout="none">
    <Subtitle />
  </Sequence>
</Sequence>
```

## Nesting compositions within another

To add a composition within another composition, you can use the `<Sequence>` component with a `width` and `height` prop to specify the size of the composition.

```tsx
<AbsoluteFill>
  <Sequence width={COMPOSITION_WIDTH} height={COMPOSITION_HEIGHT}>
    <CompositionComponent />
  </Sequence>
</AbsoluteFill>
```
````

## File: skills/remotion-motion-graphics/references/remotion-rules/sfx.md
size: 867
sha: 41fdc500de701093791c2e96d86bcfab1ca018bf
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/sfx.md

````text
---
name: sfx
description: Including sound effects
metadata:
  tags: sfx, sound, effect, audio
---

To include a sound effect, use the `<Audio>` tag:

```tsx
import { Audio } from "@remotion/sfx";

<Audio src={"https://remotion.media/whoosh.wav"} />;
```

The following sound effects are available:

- `https://remotion.media/whoosh.wav`
- `https://remotion.media/whip.wav`
- `https://remotion.media/page-turn.wav`
- `https://remotion.media/switch.wav`
- `https://remotion.media/mouse-click.wav`
- `https://remotion.media/shutter-modern.wav`
- `https://remotion.media/shutter-old.wav`
- `https://remotion.media/ding.wav`
- `https://remotion.media/bruh.wav`
- `https://remotion.media/vine-boom.wav`
- `https://remotion.media/windows-xp-error.wav`

For more sound effects, search the internet. A good resource is https://github.com/kapishdima/soundcn/tree/main/assets.
````

## File: skills/remotion-motion-graphics/references/remotion-rules/text-animations.md
size: 700
sha: e38b1c574232a34ccdb69674ea8cad68c755ce7e
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/text-animations.md

```text
---
name: text-animations
description: Typography and text animation patterns for Remotion.
metadata:
  tags: typography, text, typewriter, highlighter ken
---

## Text animations

Based on `useCurrentFrame()`, reduce the string character by character to create a typewriter effect.

## Typewriter Effect

See [Typewriter](assets/text-animations-typewriter.tsx) for an advanced example with a blinking cursor and a pause after the first sentence.

Always use string slicing for typewriter effects. Never use per-character opacity.

## Word Highlighting

See [Word Highlight](assets/text-animations-word-highlight.tsx) for an example for how a word highlight is animated, like with a highlighter pen.
```

## File: skills/remotion-motion-graphics/references/remotion-rules/timing.md
size: 4470
sha: b4a3231251f46fe7f4026f4d28bc79b4cd251b52
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/timing.md

````text
---
name: timing
description: Interpolation and timing in Remotion—prefer interpolate with Bézier easing; springs as a specialized option
metadata:
  tags: easing, bezier, interpolation, spring, timing
---

Drive motion with `interpolate()` over explicit frame range. To customize timing, use **`Easing.bezier`**. The four parameters are the same as CSS `cubic-bezier(x1, y1, x2, y2)`.

A simple linear interpolation is done using the `interpolate` function.

```ts title="Going from 0 to 1 over 100 frames"
import { interpolate } from "remotion";

const opacity = interpolate(frame, [0, 100], [0, 1]);
```

By default, the values are not clamped, so the value can go outside the range [0, 1].  
Here is how they can be clamped:

```ts title="Going from 0 to 1 over 100 frames with extrapolation"
const opacity = interpolate(frame, [0, 100], [0, 1], {
  extrapolateRight: "clamp",
  extrapolateLeft: "clamp",
});
```

## Bézier easing

Use `Easing.bezier(x1, y1, x2, y2)` inside the `interpolate` options object. The curve is identical in spirit to CSS animations and transitions, which helps when you are stealing timing from the web or from a designer’s spec.

```ts
import { interpolate, Easing } from "remotion";

const opacity = interpolate(frame, [0, 60], [0, 1], {
  easing: Easing.bezier(0.16, 1, 0.3, 1),
  extrapolateLeft: "clamp",
  extrapolateRight: "clamp",
});
```

### Examples (copy-paste curves)

**1. Crisp UI entrance (strong ease-out, no overshoot)** — slows nicely into the rest value; similar to many system “deceleration” curves.

```tsx
const enter = interpolate(frame, [0, 45], [0, 1], {
  easing: Easing.bezier(0.16, 1, 0.3, 1),
  extrapolateLeft: "clamp",
  extrapolateRight: "clamp",
});
```

**2. Editorial / slow fade (balanced ease-in-out)** — symmetric acceleration and deceleration over a hold-friendly move.

```tsx
const progress = interpolate(frame, [0, 90], [0, 1], {
  easing: Easing.bezier(0.45, 0, 0.55, 1),
  extrapolateLeft: "clamp",
  extrapolateRight: "clamp",
});
```

**3. Playful overshoot (control point y > 1)** — a little past the target then settles; use sparingly for emphasis.

```tsx
const pop = interpolate(frame, [0, 30], [0, 1], {
  easing: Easing.bezier(0.34, 1.56, 0.64, 1),
  extrapolateLeft: "clamp",
  extrapolateRight: "clamp",
});
```

## Preset easings (`Easing.in` / `Easing.out` / named curves)

Easing can be added to the `interpolate` function without a custom cubic:

```ts
import { interpolate, Easing } from "remotion";

const value1 = interpolate(frame, [0, 100], [0, 1], {
  easing: Easing.inOut(Easing.cubic),
  extrapolateLeft: "clamp",
  extrapolateRight: "clamp",
});
```

The default easing is `Easing.linear`.  
Convexities:

- `Easing.in` — starting slow and accelerating
- `Easing.out` — starting fast and slowing down
- `Easing.inOut`

Named curves (from most linear to most curved):

- `Easing.quad`
- `Easing.cubic` (good default when you do not need a custom cubic)
- `Easing.sin`
- `Easing.exp`
- `Easing.circle`

### Easing direction for enter/exit animations

Use `Easing.out` for enter animations (starts fast, decelerates into place) and `Easing.in` for exit animations (starts slow, accelerates away). This feels natural because elements arrive with momentum and leave with gravity. When you need a specific curve from design, prefer a single `Easing.bezier(...)` instead of stacking presets.

## Composing interpolations

When multiple properties share the same timing (e.g. a slide-in panel and a video shift), avoid duplicating the full interpolation for each property. Instead, create a single normalized progress value (0 to 1) and derive each property from it:

```tsx
const slideIn = interpolate(
  frame,
  [slideInStart, slideInStart + slideInDuration],
  [0, 1],
  {
    easing: Easing.bezier(0.22, 1, 0.36, 1),
    extrapolateLeft: "clamp",
    extrapolateRight: "clamp",
  },
);
const slideOut = interpolate(
  frame,
  [slideOutStart, slideOutStart + slideOutDuration],
  [0, 1],
  { easing: Easing.in(Easing.cubic), extrapolateLeft: "clamp", extrapolateRight: "clamp" },
);
const progress = slideIn - slideOut;

// Derive multiple properties from the same progress
const overlayX = interpolate(progress, [0, 1], [100, 0]);
const videoX = interpolate(progress, [0, 1], [0, -20]);
const opacity = interpolate(progress, [0, 1], [0, 1]);
```

The key idea: separate **timing** (when and how fast) from **mapping** (what values to animate between).
````

## File: skills/remotion-motion-graphics/references/remotion-rules/transitions.md
size: 5816
sha: 91ef8bd85920d7d43cbb96176a720892825767c8
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/transitions.md

````text
---
name: transitions
description: Scene transitions and overlays for Remotion using TransitionSeries.
metadata:
  tags: transitions, overlays, fade, slide, wipe, scenes
---

## TransitionSeries

`<TransitionSeries>` arranges scenes and supports two ways to enhance the cut point between them:

- **Transitions** (`<TransitionSeries.Transition>`) — crossfade, slide, wipe, etc. between two scenes. Shortens the timeline because both scenes play simultaneously during the transition.
- **Overlays** (`<TransitionSeries.Overlay>`) — render an effect (e.g. a light leak) on top of the cut point without shortening the timeline.

Children are absolutely positioned.

## Prerequisites

```bash
npx remotion add @remotion/transitions
```

## Transition example

```tsx
import { TransitionSeries, linearTiming } from "@remotion/transitions";
import { fade } from "@remotion/transitions/fade";

<TransitionSeries>
  <TransitionSeries.Sequence durationInFrames={60}>
    <SceneA />
  </TransitionSeries.Sequence>
  <TransitionSeries.Transition
    presentation={fade()}
    timing={linearTiming({ durationInFrames: 15 })}
  />
  <TransitionSeries.Sequence durationInFrames={60}>
    <SceneB />
  </TransitionSeries.Sequence>
</TransitionSeries>;
```

## Overlay example

Any React component can be used as an overlay. For a ready-made effect, see the **light-leaks** rule.

```tsx
import { TransitionSeries } from "@remotion/transitions";
import { LightLeak } from "@remotion/light-leaks";

<TransitionSeries>
  <TransitionSeries.Sequence durationInFrames={60}>
    <SceneA />
  </TransitionSeries.Sequence>
  <TransitionSeries.Overlay durationInFrames={20}>
    <LightLeak />
  </TransitionSeries.Overlay>
  <TransitionSeries.Sequence durationInFrames={60}>
    <SceneB />
  </TransitionSeries.Sequence>
</TransitionSeries>;
```

## Mixing transitions and overlays

Transitions and overlays can coexist in the same `<TransitionSeries>`, but an overlay cannot be adjacent to a transition or another overlay.

```tsx
import { TransitionSeries, linearTiming } from "@remotion/transitions";
import { fade } from "@remotion/transitions/fade";
import { LightLeak } from "@remotion/light-leaks";

<TransitionSeries>
  <TransitionSeries.Sequence durationInFrames={60}>
    <SceneA />
  </TransitionSeries.Sequence>
  <TransitionSeries.Overlay durationInFrames={30}>
    <LightLeak />
  </TransitionSeries.Overlay>
  <TransitionSeries.Sequence durationInFrames={60}>
    <SceneB />
  </TransitionSeries.Sequence>
  <TransitionSeries.Transition
    presentation={fade()}
    timing={linearTiming({ durationInFrames: 15 })}
  />
  <TransitionSeries.Sequence durationInFrames={60}>
    <SceneC />
  </TransitionSeries.Sequence>
</TransitionSeries>;
```

## Transition props

`<TransitionSeries.Transition>` requires:

- `presentation` — the visual effect (e.g. `fade()`, `slide()`, `wipe()`).
- `timing` — controls speed and easing (e.g. `linearTiming()`, `springTiming()`).

## Overlay props

`<TransitionSeries.Overlay>` accepts:

- `durationInFrames` — how long the overlay is visible (positive integer).
- `offset?` — shifts the overlay relative to the cut point center. Positive = later, negative = earlier. Default: `0`.

## Available transition types

Import transitions from their respective modules:

```tsx
import { fade } from "@remotion/transitions/fade";
import { slide } from "@remotion/transitions/slide";
import { wipe } from "@remotion/transitions/wipe";
import { flip } from "@remotion/transitions/flip";
import { clockWipe } from "@remotion/transitions/clock-wipe";
```

## Slide transition with direction

```tsx
import { slide } from "@remotion/transitions/slide";

<TransitionSeries.Transition
  presentation={slide({ direction: "from-left" })}
  timing={linearTiming({ durationInFrames: 20 })}
/>;
```

Directions: `"from-left"`, `"from-right"`, `"from-top"`, `"from-bottom"`

## Timing options

```tsx
import { linearTiming, springTiming } from "@remotion/transitions";

// Linear timing - constant speed
linearTiming({ durationInFrames: 20 });

// Spring timing - organic motion
springTiming({ config: { damping: 200 }, durationInFrames: 25 });
```

## Duration calculation

Transitions overlap adjacent scenes, so the total composition length is **shorter** than the sum of all sequence durations. Overlays do **not** affect the total duration.

For example, with two 60-frame sequences and a 15-frame transition:

- Without transitions: `60 + 60 = 120` frames
- With transition: `60 + 60 - 15 = 105` frames

Adding an overlay between two other sequences does not change the total.

### Getting the duration of a transition

Use the `getDurationInFrames()` method on the timing object:

```tsx
import { linearTiming, springTiming } from "@remotion/transitions";

const linearDuration = linearTiming({
  durationInFrames: 20,
}).getDurationInFrames({ fps: 30 });
// Returns 20

const springDuration = springTiming({
  config: { damping: 200 },
}).getDurationInFrames({ fps: 30 });
// Returns calculated duration based on spring physics
```

For `springTiming` without an explicit `durationInFrames`, the duration depends on `fps` because it calculates when the spring animation settles.

### Calculating total composition duration

```tsx
import { linearTiming } from "@remotion/transitions";

const scene1Duration = 60;
const scene2Duration = 60;
const scene3Duration = 60;

const timing1 = linearTiming({ durationInFrames: 15 });
const timing2 = linearTiming({ durationInFrames: 20 });

const transition1Duration = timing1.getDurationInFrames({ fps: 30 });
const transition2Duration = timing2.getDurationInFrames({ fps: 30 });

const totalDuration =
  scene1Duration +
  scene2Duration +
  scene3Duration -
  transition1Duration -
  transition2Duration;
// 60 + 60 + 60 - 15 - 20 = 145 frames
```
````

## File: skills/remotion-motion-graphics/references/remotion-rules/videos.md
size: 3509
sha: 4d99b31eab0bf8ba21d692751876a0453d365080
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/remotion-rules/videos.md

````text
---
name: videos
description: Embedding videos in Remotion - trimming, volume, speed, looping, pitch
metadata:
  tags: video, media, trim, volume, speed, loop, pitch
---

# Using videos in Remotion

## Prerequisites

First, the @remotion/media package needs to be installed.  
If it is not, use the following command:

```bash
npx remotion add @remotion/media # If project uses npm
bunx remotion add @remotion/media # If project uses bun
yarn remotion add @remotion/media # If project uses yarn
pnpm exec remotion add @remotion/media # If project uses pnpm
```

Use `<Video>` from `@remotion/media` to embed videos into your composition.

```tsx
import { Video } from "@remotion/media";
import { staticFile } from "remotion";

export const MyComposition = () => {
  return <Video src={staticFile("video.mp4")} />;
};
```

Remote URLs are also supported:

```tsx
<Video src="https://remotion.media/video.mp4" />
```

## Trimming

Use `trimBefore` and `trimAfter` to remove portions of the video. Values are in seconds.

```tsx
const { fps } = useVideoConfig();

return (
  <Video
    src={staticFile("video.mp4")}
    trimBefore={2 * fps} // Skip the first 2 seconds
    trimAfter={10 * fps} // End at the 10 second mark
  />
);
```

## Delaying

Wrap the video in a `<Sequence>` to delay when it appears:

```tsx
import { Sequence, staticFile } from "remotion";
import { Video } from "@remotion/media";

const { fps } = useVideoConfig();

return (
  <Sequence from={1 * fps}>
    <Video src={staticFile("video.mp4")} />
  </Sequence>
);
```

The video will appear after 1 second.

## Sizing and Position

Use the `style` prop to control size and position:

```tsx
<Video
  src={staticFile("video.mp4")}
  style={{
    width: 500,
    height: 300,
    position: "absolute",
    top: 100,
    left: 50,
    objectFit: "cover",
  }}
/>
```

## Volume

Set a static volume (0 to 1):

```tsx
<Video src={staticFile("video.mp4")} volume={0.5} />
```

Or use a callback for dynamic volume based on the current frame:

```tsx
import { interpolate } from "remotion";

const { fps } = useVideoConfig();

return (
  <Video
    src={staticFile("video.mp4")}
    volume={(f) =>
      interpolate(f, [0, 1 * fps], [0, 1], { extrapolateRight: "clamp" })
    }
  />
);
```

Use `muted` to silence the video entirely:

```tsx
<Video src={staticFile("video.mp4")} muted />
```

## Speed

Use `playbackRate` to change the playback speed:

```tsx
<Video src={staticFile("video.mp4")} playbackRate={2} /> {/* 2x speed */}
<Video src={staticFile("video.mp4")} playbackRate={0.5} /> {/* Half speed */}
```

Reverse playback is not supported.

## Looping

Use `loop` to loop the video indefinitely:

```tsx
<Video src={staticFile("video.mp4")} loop />
```

Use `loopVolumeCurveBehavior` to control how the frame count behaves when looping:

- `"repeat"`: Frame count resets to 0 each loop (for `volume` callback)
- `"extend"`: Frame count continues incrementing

```tsx
<Video
  src={staticFile("video.mp4")}
  loop
  loopVolumeCurveBehavior="extend"
  volume={(f) => interpolate(f, [0, 300], [1, 0])} // Fade out over multiple loops
/>
```

## Pitch

Use `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2:

```tsx
<Video
  src={staticFile("video.mp4")}
  toneFrequency={1.5} // Higher pitch
/>
<Video
  src={staticFile("video.mp4")}
  toneFrequency={0.8} // Lower pitch
/>
```

Pitch shifting only works during server-side rendering, not in the Remotion Studio preview or in the `<Player />`.
````

## File: skills/remotion-motion-graphics/references/scene-patterns.md
size: 7376
sha: ad8c0e190289d374511440cf243a747037e1f1c6
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/scene-patterns.md

````text
# Motion pattern catalogue

Building blocks that make a kinetic-typography / brand promo feel designed.
Each pattern names the effect, when it earns its place, and the code shape.
Everything uses `frame = useCurrentFrame()`, `prog()` / `springAt()` from
`anim.ts`, and positions from `useLayout()`. Combine 10-15 of these at
1-4 seconds each for a 30-second piece; alternate light and dark backgrounds
so hard cuts read as deliberate.

## Contents
1. Word-by-word reveal (`<Words>`)
2. Phrase swap in a sentence
3. Pill that morphs into a button, cursor click
4. Objects flying into a collage
5. Circle wipe carrying text
6. Ticker + panel wipe + marquee bar
7. Shape that shrinks into the next scene's element
8. Route / line drawing on a map
9. Product-UI moment (typewriter, toggle, radios, dot cursor)
10. Gradient statement text with a swap
11. Character bounce + wordmark letters popping
12. Scrolling bubble rows with one highlighted
13. Card with a growing chart
14. Spotlight beam
15. Burst of chips collapsing into the final lockup
16. Fade to black

---

## 1. Word-by-word reveal
Every headline lands one word at a time (5-7 frame stagger, 12-14 frame
rise + fade + 3px blur that clears). Use `<Words text start stagger dur out>`;
give `out` when the line must leave before the next arrives.

## 2. Phrase swap in a sentence
"Want ⚡ to learn faster? / to grow further? / to stop guessing?" — the fixed
words stay put, the variable phrase cycles. Stack all phrases absolutely at the
same spot and give each an `IN[i]` / `OUT[i]` window (about 40-50 frames per
phrase). Exits accelerate up and fade (EASE_IN); entrances rise (EASE_OUT).
Keep fixed text right-aligned to a fixed x and the phrase left-aligned to it
so the layout never reflows when word widths change.

## 3. Pill → button → click
A small white pill (emoji inside) springs into the sentence
(`springAt(frame,fps,30,{damping:14,stiffness:140})`, width = 92 × p). At the
scene end the sentence fades and the pill eases to centre. Next scene: the pill
grows (`lerp(92,360,prog(frame,0,14))`), the emoji fades, a label types in
(`typed(text, frame, 6, 40, fps)`), a cursor springs to it and "presses"
(scale 0.96 for 5 frames), then the button fades out. Cursor moves are chained
springs so it never teleports:
```ts
const c1 = springAt(frame, fps, 8, { damping: 16, stiffness: 80 });
const c2 = springAt(frame, fps, 34, { damping: 16, stiffness: 80 });
const x = lerp(lerp(x0, x1, c1), x2, c2);
```

## 4. Objects flying into a collage
Cards / photos start off-screen on all sides with ±30° rotation and spring to
scattered resting spots (`damping: 17, stiffness: 95`, 3-frame stagger), a
bold white line lands on top with a dark text-shadow. Define resting and start
positions as fractions of W/H, with a separate set for landscape.

## 5. Circle wipe carrying text
A black circle grows from centre to `diag × 1.25` over 20 frames (EASE_INOUT).
Text sits at the circle's centre (`left:50%; top:50%; translate(-50%,-50%)`) so
it stays fixed while the circle grows; second line appears after the wipe
completes, first line lifts 44px to make room. Do not add a full-frame overlay
"to tidy the edges" — the circle already covers the frame and the overlay hides
the text.

## 6. Ticker + panel wipe + marquee bar
A line translates across at constant speed (`interpolate(frame,[0,41],[W*0.48,-W*0.48])`).
Mid-way a white panel slides in diagonally from the top-right
(`translate((1-p)*W, -(1-p)*H*0.55)`), carrying a black bar with a very wide
blue pill whose text scrolls left 26px/frame. Two motions at once give energy
without a cut.

## 7. Shape that becomes the next element
Grey card, a blue pill with a word → text fades, pill shrinks to a circle,
background darkens (`interpolateColors`), circle travels to exactly where the
next scene's marker sits. Export the marker position from a shared helper
(`markerPos()` in layout.ts) so both scenes agree.

## 8. Route drawing
`<path pathLength={1} strokeDasharray={1} strokeDashoffset={1 - draw} />` with
`draw = prog(frame, 0, 45, EASE_INOUT)`. Define the path in fractions of W/H so
it survives both orientations. Add a pulsing halo (`sin` on scale/opacity), a
marker, a tooltip that types two lines, and a slow 10% zoom on the whole map
with `transformOrigin` at the marker.

## 9. Product-UI moment
Typewriter headline + body (`typed()` with `whiteSpace: "pre-line"`), a toggle
whose knob slides with a spring and whose track alpha follows the same value,
radio dots that change on a click, and a black dot cursor with chained springs
that presses on the toggle then the radio. Lay the group out as a fixed 900px
block centred with `gx = cx - 450; gy = cy - 240`.

## 10. Gradient statement text
Two lines stacked at the same spot; each has `background: linear-gradient(...)`,
`WebkitBackgroundClip: "text"`, `color: "transparent"`. Line 1 scales
0.94→1 and fades in, exits up (EASE_IN); line 2 rises in 4 frames later. A
radial glow behind grows from 0 over 40 frames.

## 11. Character bounce + wordmark letters popping
Use `SvgArt` with `parts: { body: { indices, origin: "50% 100%", style: characterStyle({ entrance: 4, bobAmp: 55, period: 36, tilt: 2.5 }) }, letters: { indices, popEach: { start: 12, stagger: 2 } } }`.
Bob amplitude is in viewBox units (50-60 on a 4096 canvas). Order letter
indices along the arc (sort by angle around a point below the arc) so they pop
in reading order. Add `fadeLeft` when the artwork is cropped at the canvas
edge.

## 12. Scrolling bubble rows
6-7 rows of dark rounded pills (random widths via `random(seed)`), alternating
direction and speed, one fixed pill with a blue border and glow that types a
short line. Portrait: rows start at ~17% height; landscape: start above the
frame so rows fill it.

## 13. Card with a growing chart
Sample 48 points of a rising noisy function into a polyline; reveal with a
`<clipPath>` rect whose width = head.x; put a white dot at the interpolated
head point; area fill under the line with a vertical brand gradient. Card
scales 0.9→1 and drifts a few px over the scene.

## 14. Spotlight beam
Two stacked cones (wide soft + narrow bright). Put `filter: blur()` on the
wrapper and `clipPath: polygon(...)` on the inner div — CSS applies filter
before clip-path, so blurring a clipped element gives hard edges. Sway with
`rotate(sin(frame/15)*2.5deg)` from `transformOrigin: "50% 0%"`.

## 15. Burst → lockup
18 chips start on a ring (radius 700-1200, seeded angle), rush to centre with
EASE_IN over 16 frames while blurring (`blur((1-p)*6px)`) and fading; the logo
springs in with `damping: 11-12` (visible bounce) as they vanish; letters pop;
tagline rises; URL pill springs; feature chips stagger 4 frames apart.
Landscape: logo left, copy right; portrait: logo above copy.

## 16. Fade to black
Full-frame ink overlay `opacity: prog(frame, T-14, 14, EASE_IN)` in the last
scene. Always end on a resting frame (nothing still moving).

---

## Timing that felt right (30 fps)
- Hook with 3 phrase swaps: 135 frames. Button + collage: 75. Wipe + line: 45.
- Ticker/panel: 41. Shape hand-off: 19. Map: 105. UI: 105. Statement: 75.
- Character: 60. Bubbles: 60. Chart: 45. Character 2: 75. Spotlight: 45.
- Closing line: 51. Burst + lockup + fade: 84. Total ≈ 1020 (34 s).
Cut faster than feels comfortable in code; it plays slower than it reads.
````

## File: skills/remotion-motion-graphics/references/verification-and-gotchas.md
size: 3386
sha: 2c1587d14cac1f4c224e2939f70e6aca44231ac7
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/references/verification-and-gotchas.md

```text
# Verification loop and gotchas

## The loop (do it every time, it costs a minute)
1. `npx tsc --noEmit` — catches prop and import mistakes before Chrome does.
2. `scripts/check_render.sh <CompId> <out_dir>` — 0.3-scale MP4 + contact
   sheets. View every sheet. Look for: empty frames (a scene crashed or an
   overlay hides content), text under artwork, elements off the safe zone,
   things still moving on the last frame of a scene, colour jumps at cuts.
3. For a suspicious moment, render one still at 0.5:
   `npx remotion still <CompId> out/f200.png --frame=200 --scale=0.5`
   or grab a frame from the preview with `scripts/still_frame.sh`.
4. Fix, re-run 1-2 only for changed scenes if you can (a still is enough for a
   local fix), full check again before the final render.
5. Final: `npx remotion render <CompId> out/final.mp4 --codec=h264 --crf=18`
   (1020 frames at 1080x1920 renders in ~30 s on an M-series Mac).
6. Extract one or two frames from the FINAL file too — the final render is the
   thing being shipped, not the preview.

## Gotchas met in practice
- **Overlay hides content.** A "cleanup" full-frame overlay drawn after the
  content covers the text. Check z-order before adding overlays; usually the
  wipe shape already covers the frame.
- **filter + clip-path order.** CSS applies `filter` before `clip-path`, so a
  blurred cone clipped to a polygon has razor edges. Blur the parent, clip the
  child.
- **Artwork cropped at the SVG canvas edge** (a character running off the
  page) shows a hard vertical cut on a dark background. Mask the element with
  a gradient that is fully transparent for the first ~4% and opaque by ~17%;
  a 9% fade is too weak to hide the cut.
- **Gradient fills in exported SVGs** (`fill="url(#gradient_1)"`) render
  black without their `<defs>`. `svg_to_paths.mjs` swaps them for the first
  stop colour.
- **Per-path transforms in inline SVG** need `transformBox: "fill-box"` plus
  `transformOrigin`, otherwise scale/rotate pivots on the canvas origin.
- **`pathLength={1}`** normalises stroke dash math so `strokeDashoffset = 1 - p`
  draws any path regardless of its true length.
- **`interpolate` input ranges must strictly increase** — duplicate stops crash
  the frame.
- **Negative-frame springs**: guard with `frame <= start ? 0 : spring(...)`
  (`springAt` does) so look-behind sampling for cursor trails is safe.
- **Bob amplitude inside an SVG is in viewBox units**, not screen px (50 units
  on a 4096 canvas ≈ 10 px at 840 px wide).
- **Shell env vars into node**: `export S=...` before `node -e '...process.env.S'`;
  unexported vars come through as `undefined` paths.
- **rsvg-convert / qlmanage are unreliable** for SVG previews on macOS; verify
  artwork splits with a Remotion still instead — Chrome is the renderer that
  matters.
- **Emoji** render fine in Remotion's Chrome on macOS (Apple Color Emoji);
  on Linux CI install a colour emoji font or replace them with SVG icons.
- **Landscape from portrait**: do not letterbox. Derive positions from
  `useLayout()`, keep a 1.2 design scale for 16:9, and give tall artwork a
  side-by-side branch (`wide ? {...} : {...}`). Re-check the portrait sheet
  after the refactor to prove nothing moved.
- **Deliver the file**: copy the MP4 next to the user's source material and
  send it with the file tool; a path in a message is easy to miss.
```

## File: skills/remotion-motion-graphics/assets/anim.ts
size: 1728
sha: fa078419db1e89ef77f25d7f694267202da56fa6
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/assets/anim.ts

```text
import { Easing, interpolate, spring } from "remotion";

// Copy-paste curves from the Remotion best-practices rules.
export const EASE_OUT = Easing.bezier(0.16, 1, 0.3, 1); // crisp UI entrance
export const EASE_IN = Easing.bezier(0.7, 0, 0.84, 0); // exits accelerate away
export const EASE_INOUT = Easing.bezier(0.65, 0, 0.35, 1);
export const POP = Easing.bezier(0.34, 1.56, 0.64, 1); // playful overshoot

// Normalised 0..1 progress over [start, start+dur] with an easing.
export const prog = (
  frame: number,
  start: number,
  dur: number,
  easing: (t: number) => number = EASE_OUT,
) =>
  interpolate(frame, [start, start + dur], [0, 1], {
    easing,
    extrapolateLeft: "clamp",
    extrapolateRight: "clamp",
  });

type SpringOpts = {
  damping?: number;
  mass?: number;
  stiffness?: number;
  durationInFrames?: number;
};

// Spring progress guarded for negative frames (safe for look-behind sampling).
export const springAt = (
  frame: number,
  fps: number,
  start: number,
  opts: SpringOpts = {},
): number => {
  if (frame <= start) return 0;
  const { durationInFrames, ...config } = opts;
  return spring({
    frame: frame - start,
    fps,
    durationInFrames,
    config: { damping: 200, ...config },
  });
};

export const riseStyle = (
  p: number,
  dy = 40,
  dx = 0,
): React.CSSProperties => ({
  opacity: p,
  transform: `translate(${(1 - p) * dx}px, ${(1 - p) * dy}px)`,
});

// Typewriter by string slicing (never per-character opacity).
export const typed = (
  text: string,
  frame: number,
  start: number,
  cps: number,
  fps: number,
) => text.slice(0, Math.max(0, Math.floor(((frame - start) * cps) / fps)));

export const clamp01 = (v: number) => Math.min(1, Math.max(0, v));
```

## File: skills/remotion-motion-graphics/assets/components/Backgrounds.tsx
size: 1340
sha: 9090314ea98f948648e1973690105902f0d73fd8
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/assets/components/Backgrounds.tsx

```text
import { AbsoluteFill } from "remotion";
import { C, hexToRgba } from "../theme";

// Light backdrop: white top fading into a soft brand glow at the bottom
// (the reference used lavender; hundredable's brand yellow takes its place).
export const LightBg: React.FC<{
  glow?: number; // 0..1.2
  color?: string;
  y?: number; // glow center y in %
}> = ({ glow = 1, color = C.yellow, y = 100 }) => (
  <AbsoluteFill style={{ backgroundColor: C.lightBase }}>
    <AbsoluteFill
      style={{
        background: `radial-gradient(ellipse 85% 55% at 50% ${y}%, ${hexToRgba(
          color,
          0.5 * glow,
        )} 0%, ${hexToRgba(color, 0)} 72%)`,
      }}
    />
    <AbsoluteFill
      style={{
        background:
          "linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,0) 40%)",
      }}
    />
  </AbsoluteFill>
);

export const DarkBg: React.FC<{
  glow?: number; // 0..0.5
  color?: string;
  x?: number;
  y?: number;
  size?: number;
}> = ({ glow = 0, color = C.yellow, x = 50, y = 60, size = 60 }) => (
  <AbsoluteFill style={{ backgroundColor: C.dark }}>
    {glow > 0 && (
      <AbsoluteFill
        style={{
          background: `radial-gradient(circle at ${x}% ${y}%, ${hexToRgba(
            color,
            glow,
          )} 0%, rgba(0,0,0,0) ${size}%)`,
        }}
      />
    )}
  </AbsoluteFill>
);
```

## File: skills/remotion-motion-graphics/assets/components/Cursors.tsx
size: 1355
sha: 93d2b856bcbee77dbe796cc43ca849699502aa21
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/assets/components/Cursors.tsx

```text
import { C } from "../theme";

type Pt = { x: number; y: number };

// macOS-style pointer arrow (used in the light scenes of the reference).
export const ArrowCursor: React.FC<{
  pos: Pt;
  color?: string;
  pressed?: boolean;
  opacity?: number;
  size?: number;
}> = ({ pos, color = C.blue, pressed, opacity = 1, size = 46 }) => (
  <svg
    viewBox="0 0 24 24"
    width={size}
    height={size}
    style={{
      position: "absolute",
      left: pos.x,
      top: pos.y,
      opacity,
      transform: `scale(${pressed ? 0.86 : 1})`,
      transformOrigin: "22% 12%",
      filter: "drop-shadow(0 6px 10px rgba(0,0,0,0.25))",
    }}
  >
    <path
      d="M5.5 3.2 L5.5 20.5 L9.8 16.6 L12.6 22.6 L15.6 21.2 L12.9 15.3 L18.6 15.3 Z"
      fill={color}
      stroke="#FFFFFF"
      strokeWidth={1.6}
      strokeLinejoin="round"
    />
  </svg>
);

// Black dot cursor (used in the UI scene of the reference).
export const DotCursor: React.FC<{
  pos: Pt;
  pressed?: boolean;
  opacity?: number;
}> = ({ pos, pressed, opacity = 1 }) => (
  <div
    style={{
      position: "absolute",
      left: pos.x - 12,
      top: pos.y - 12,
      width: 24,
      height: 24,
      borderRadius: "50%",
      background: C.ink,
      opacity,
      transform: `scale(${pressed ? 0.75 : 1})`,
      boxShadow: "0 6px 16px rgba(0,0,0,0.35)",
    }}
  />
);
```

## File: skills/remotion-motion-graphics/assets/components/SvgArt.tsx
size: 4330
sha: 234d8e06ee31f8724490a012af41ee454e1df7ea
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/assets/components/SvgArt.tsx

```text
// Renders SVG artwork (a logo, mascot, icon) straight from path data produced
// by scripts/svg_to_paths.mjs, so any subset of paths can be animated on its
// own: letters popping in one by one, a character bobbing, a part rotating.
// Copy to src/components/SvgArt.tsx.
import { useCurrentFrame, useVideoConfig } from "remotion";
import { springAt } from "../anim";

export type SvgPath = { d: string; fill: string; box: [number, number, number, number] };
export type SvgData = { box: [number, number, number, number]; paths: SvgPath[] };

export const unionBox = (paths: SvgPath[]): [number, number, number, number] => [
  Math.min(...paths.map((p) => p.box[0])),
  Math.min(...paths.map((p) => p.box[1])),
  Math.max(...paths.map((p) => p.box[2])),
  Math.max(...paths.map((p) => p.box[3])),
];

// A part = a named group of path indices with its own animation.
export type Part = {
  indices: number[];
  // Return CSS for the group at this frame. transform-box is fill-box, so
  // scale()/rotate() pivot on the group's own centre (or `origin`).
  style?: (frame: number, fps: number) => React.CSSProperties;
  origin?: string; // e.g. "50% 100%" to pivot on the feet
  // Stagger helper: pop each path in the part individually.
  popEach?: { start: number; stagger: number; damping?: number; stiffness?: number };
};

export const SvgArt: React.FC<{
  data: SvgData;
  width: number;
  parts?: Record<string, Part>;
  crop?: number[]; // path indices to fit the viewBox to (default: all)
  pad?: number;
  fadeLeft?: boolean; // soften artwork cropped at the canvas edge
  style?: React.CSSProperties;
}> = ({ data, width, parts = {}, crop, pad = 80, fadeLeft, style }) => {
  const frame = useCurrentFrame();
  const { fps } = useVideoConfig();
  const box = crop ? unionBox(crop.map((i) => data.paths[i])) : data.box;
  const vb = [box[0] - pad, box[1] - pad, box[2] - box[0] + pad * 2, box[3] - box[1] + pad * 2];
  const height = (width * vb[3]) / vb[2];
  const assigned = new Set(Object.values(parts).flatMap((p) => p.indices));
  const mask = fadeLeft
    ? "linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 4.5%, rgba(0,0,0,1) 17%, rgba(0,0,0,1) 100%)"
    : undefined;

  return (
    <svg
      viewBox={vb.join(" ")}
      width={width}
      height={height}
      style={{ overflow: "visible", WebkitMaskImage: mask, maskImage: mask, WebkitMaskSize: "100% 100%", maskSize: "100% 100%", ...style }}
    >
      {/* static paths */}
      {data.paths.map((p, i) => (assigned.has(i) ? null : <path key={i} d={p.d} fill={p.fill} />))}
      {/* animated parts */}
      {Object.entries(parts).map(([name, part]) => {
        if (part.popEach) {
          const { start, stagger, damping = 10, stiffness = 170 } = part.popEach;
          return part.indices.map((i, k) => {
            const p = springAt(frame, fps, start + k * stagger, { damping, stiffness });
            return (
              <g key={`${name}-${i}`} style={{ transformBox: "fill-box", transformOrigin: "center", transform: `scale(${p})`, opacity: Math.max(0, Math.min(1, p * 1.5)) }}>
                <path d={data.paths[i].d} fill={data.paths[i].fill} />
              </g>
            );
          });
        }
        return (
          <g key={name} style={{ transformBox: "fill-box", transformOrigin: part.origin ?? "center", ...(part.style ? part.style(frame, fps) : {}) }}>
            {part.indices.map((i) => (
              <path key={i} d={data.paths[i].d} fill={data.paths[i].fill} />
            ))}
          </g>
        );
      })}
    </svg>
  );
};

// Ready-made character motion: spring in from below, then bob + sway.
export const characterStyle =
  (opts: { entrance?: number | null; bobAmp?: number; period?: number; tilt?: number }) =>
  (frame: number, fps: number): React.CSSProperties => {
    const { entrance = 0, bobAmp = 50, period = 40, tilt = 2.5 } = opts;
    const ent = entrance === null ? 1 : springAt(frame, fps, entrance, { damping: 12, stiffness: 110, mass: 0.9 });
    const bob = Math.sin((frame / period) * Math.PI * 2) * bobAmp;
    const rot = Math.sin((frame / period) * Math.PI * 2 + 1.2) * tilt;
    return {
      transform: `translateY(${bob}px) rotate(${rot}deg) translateY(${(1 - ent) * 60}%) scale(${0.7 + 0.3 * ent})`,
      opacity: Math.max(0, Math.min(1, ent * 2)),
    };
  };
```

## File: skills/remotion-motion-graphics/assets/components/Words.tsx
size: 1413
sha: 2372642c99ea6929dc247af4e4b6593ed8909921
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/assets/components/Words.tsx

```text
import { useCurrentFrame } from "remotion";
import { EASE_IN, EASE_OUT, prog } from "../anim";

// Word-by-word reveal (rise + fade), optional exit. Mirrors the kinetic type
// in the reference video where each word lands a few frames after the last.
export const Words: React.FC<{
  text: string;
  start: number;
  stagger?: number;
  dur?: number;
  out?: { start: number; dur?: number };
  style?: React.CSSProperties;
  wordStyle?: (word: string, i: number) => React.CSSProperties;
  dy?: number;
}> = ({ text, start, stagger = 5, dur = 14, out, style, wordStyle, dy = 22 }) => {
  const frame = useCurrentFrame();
  const words = text.split(" ");
  return (
    <span style={{ display: "inline", ...style }}>
      {words.map((w, i) => {
        const p = prog(frame, start + i * stagger, dur, EASE_OUT);
        const q = out ? prog(frame, out.start + i * 2, out.dur ?? 10, EASE_IN) : 0;
        return (
          <span
            key={i}
            style={{
              display: "inline-block",
              whiteSpace: "pre",
              opacity: p * (1 - q),
              transform: `translateY(${(1 - p) * dy - q * 36}px)`,
              filter: p < 1 ? `blur(${(1 - p) * 3}px)` : undefined,
              ...(wordStyle ? wordStyle(w, i) : {}),
            }}
          >
            {w}
            {i < words.length - 1 ? " " : ""}
          </span>
        );
      })}
    </span>
  );
};
```

## File: skills/remotion-motion-graphics/assets/fonts.ts
size: 266
sha: bbe844453eaac4417d5b582d3b11ab376d939a63
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/assets/fonts.ts

```text
// Copy to src/fonts.ts. Match the brand's font; Inter is the safe default.
import { loadFont } from "@remotion/google-fonts/Inter";

export const { fontFamily: inter } = loadFont("normal", {
  weights: ["400", "500", "600", "700", "800"],
  subsets: ["latin"],
});
```

## File: skills/remotion-motion-graphics/assets/layout.ts
size: 994
sha: 13a172e44a380c613e16ee383fd81e8646e51821
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/assets/layout.ts

```text
import { useVideoConfig } from "remotion";

// Everything positional derives from the composition size, so the same scenes
// render the 9:16 (1080x1920) and 16:9 (1920x1080) versions.
// The wide version is designed at 1600x900 and scaled up 1.2x in <Main> so
// type and UI read at a comfortable size on a landscape frame.
export const designScale = (width: number, height: number) => (width > height ? 1.2 : 1);

export const useLayout = () => {
  const { width, height } = useVideoConfig();
  const s = designScale(width, height);
  const W = width / s;
  const H = height / s;
  return { W, H, cx: W / 2, cy: H / 2, wide: W > H, diag: Math.hypot(W, H), scale: s };
};

export const PILL = { w: 92, h: 60 } as const;
// vertical centre of the "Want ⚡ ..." row (≈42-44% down the frame)
export const hookRowY = (cy: number, H: number) => cy - H * 0.083;
// the map marker the blue pill shrinks into
export const markerPos = (cx: number, H: number) => ({ x: cx, y: H * 0.615, size: 46 });
```

## File: skills/remotion-motion-graphics/assets/Main.template.tsx
size: 1150
sha: 4154126d5bdf8f3d4cfe9654b161a158fd135ab2
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/assets/Main.template.tsx

```text
// Copy to src/Main.tsx. Arranges scenes in a <Series> (hard cuts, like most
// kinetic-type promos) inside a design-scale wrapper so one set of scenes
// serves both 9:16 and 16:9 compositions (see layout.ts).
import { AbsoluteFill, Series } from "remotion";
import { inter } from "./fonts";
import { SCENES } from "./theme";
import { useLayout } from "./layout";
import { S01Hook } from "./scenes/S01Hook";
// ...import the rest of the scenes

const ORDER: [keyof typeof SCENES, React.FC][] = [
  ["hook", S01Hook],
  // ["reveal", S02Reveal], ...
];

export const Main: React.FC = () => {
  const { W, H, scale } = useLayout();
  return (
    <AbsoluteFill style={{ fontFamily: inter, backgroundColor: "#0A0A0A", overflow: "hidden" }}>
      <div style={{ position: "absolute", left: 0, top: 0, width: W, height: H, transform: `scale(${scale})`, transformOrigin: "0 0" }}>
        <Series>
          {ORDER.map(([key, Scene]) => (
            <Series.Sequence key={key} durationInFrames={SCENES[key]} premountFor={15}>
              <Scene />
            </Series.Sequence>
          ))}
        </Series>
      </div>
    </AbsoluteFill>
  );
};
```

## File: skills/remotion-motion-graphics/assets/Root.template.tsx
size: 554
sha: 3b430e0333d7efc1d50c2b3e4c1f3767ef2699f6
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/assets/Root.template.tsx

```text
// Copy to src/Root.tsx. Two compositions, same component.
import "./index.css";
import { Composition } from "remotion";
import { Main } from "./Main";
import { LANDSCAPE, PORTRAIT, TOTAL } from "./theme";

export const RemotionRoot: React.FC = () => (
  <>
    <Composition id="Promo" component={Main} durationInFrames={TOTAL} fps={PORTRAIT.fps} width={PORTRAIT.width} height={PORTRAIT.height} />
    <Composition id="PromoWide" component={Main} durationInFrames={TOTAL} fps={LANDSCAPE.fps} width={LANDSCAPE.width} height={LANDSCAPE.height} />
  </>
);
```

## File: skills/remotion-motion-graphics/assets/theme.template.ts
size: 1578
sha: 20cd81c9e8ba3ec33a2cd7cc8d75ad68f09ed595
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/skills/remotion-motion-graphics/assets/theme.template.ts

```text
// Brand + timing system. Copy to src/theme.ts and fill the colours from the
// brand (logo SVG fills, site CSS variables). Keep ONE accent + ink + a light
// base; motion pieces read best with few colours used consistently.
export const PORTRAIT = { width: 1080, height: 1920, fps: 30 } as const;
export const LANDSCAPE = { width: 1920, height: 1080, fps: 30 } as const;

export const C = {
  ink: "#0A0A0A",
  white: "#FFFFFF",
  accent: "#FBF713", // >>> primary brand colour (glows, pills, highlight word)
  accent2: "#0A8CF0", // >>> secondary brand colour (blue text, buttons)
  accentText: "#1C7DE8", // slightly darker accent2 for text on light
  lightBase: "#FCFBF6", // near-white light background
  gray: "#B8B8B8",
  dark: "#070707",
  surface: "#141414",
  surface2: "#1E1E1E",
  border: "rgba(255,255,255,0.10)",
  textDim: "rgba(255,255,255,0.62)",
  inkDim: "rgba(10,10,10,0.5)",
} as const;

// Scene durations in frames, in playback order. Name every beat; the sum is
// the composition length, so re-timing one scene never breaks the others.
export const SCENES = {
  hook: 135,
  reveal: 75,
  statement: 45,
  final: 84,
} as const;

export const TOTAL = Object.values(SCENES).reduce((a, b) => a + b, 0);

export const hexToRgba = (hex: string, alpha: number) => {
  const h = hex.replace("#", "");
  const r = parseInt(h.substring(0, 2), 16);
  const g = parseInt(h.substring(2, 4), 16);
  const b = parseInt(h.substring(4, 6), 16);
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
};

export const lerp = (a: number, b: number, t: number) => a + (b - a) * t;
```

## File: README.md
upstream: https://github.com/boriwatopal/agent-skill-remotion-motion-graphics/blob/main/README.md

````text
# Remotion Motion Graphics - Agent Skill

A Claude skill for building kinetic-typography / logo / brand promo motion graphics **as code** with [Remotion](https://www.remotion.dev) (React) and shipping an MP4. It covers the whole path: reading a reference clip and a brand's SVG logo, a scene-per-beat project with reusable animation helpers, a verify-by-contact-sheet loop, both 9:16 and 16:9 outputs from one codebase, and Remotion Studio for tweaks.

Built while cloning the motion of a reference promo for [hundredable.com](https://hundredable.com) — the workflow is general, the video is not included.

## Install

**Claude Code (CLI / desktop app)** — clone the skill into your skills folder:

```bash
git clone https://github.com/Boriwatopal/agent-skill-remotion-motion-graphics.git /tmp/rmg && \
cp -R /tmp/rmg/skills/remotion-motion-graphics ~/.claude/skills/ && rm -rf /tmp/rmg
```

Or for one project only: copy `skills/remotion-motion-graphics` into `<project>/.claude/skills/`.

**claude.ai / Cowork** — download [`dist/remotion-motion-graphics.skill`](dist/remotion-motion-graphics.skill) (or grab it from the latest [release](../../releases)) and upload it in Settings → Capabilities → Skills.

Then just ask for a motion piece: the skill triggers on requests like *"make an animated logo from this SVG"*, *"make a promo clip like this video"*, *"ทำโมชั่นโลโก้"*, or any Remotion code work.

## Folder Structure

```
skills/remotion-motion-graphics/
  SKILL.md                              # The workflow: read material → scaffold → scenes → verify → deliver
  assets/                               # Starter code to copy into src/
    theme.template.ts                   #   brand colours, PORTRAIT/LANDSCAPE presets, named scene durations
    layout.ts                           #   useLayout() — every position derives from the frame size
    anim.ts                             #   easing curves, prog(), springAt(), riseStyle(), typed()
    fonts.ts, Main.template.tsx, Root.template.tsx
    components/
      Backgrounds.tsx                   #   LightBg / DarkBg with brand glow
      Cursors.tsx                       #   arrow + dot cursors that spring between targets
      Words.tsx                         #   word-by-word reveal with optional exit
      SvgArt.tsx                        #   animate SVG artwork per path (letter pop, character bounce)
  scripts/
    analyze_reference.sh                # contact sheets from a reference video → beat map
    svg_to_paths.mjs                    # SVG → TypeScript path data + bounding-box report
    check_render.sh                     # low-res render + contact sheets for a composition
    still_frame.sh                      # one frame from an MP4 at a timestamp
  references/
    scene-patterns.md                   # 16 motion patterns with the timings that worked
    verification-and-gotchas.md         # the check loop and the traps met in practice
    remotion-rules/                     # 13 official Remotion rule files (see Credits)
dist/remotion-motion-graphics.skill     # packaged skill for claude.ai upload
```

## What the workflow does

1. **Read the material first.** Contact sheets from the reference clip become a beat map; the brand site or the logo's SVG fills give colours, font and real copy; the logo's paths are mapped so letters and character can animate separately.
2. **One skeleton for every ratio.** Named scene durations in one theme file, a layout hook so positions derive from `useVideoConfig()`, one file per scene. A second `<Composition>` gives 16:9 without a second codebase.
3. **Patterns, not improvisation.** Phrase swap, pill → button → click, flying collage, circle wipe, ticker + panel wipe, shape hand-off between scenes, route drawing, UI toggle moment, gradient statement, character + letter pop, bubble rows, chart card, spotlight, burst → lockup, fade out.
4. **Verify like an editor.** `tsc` → 0.3-scale render → look at every contact sheet → still-render suspicious frames → fix → final render → pull a frame from the final file as proof.
5. **Deliver.** MP4 next to the source files, Remotion Studio for scrubbing, an honest summary of what was invented and what was left out.

## Requirements

- Node.js 18+ (Remotion 4), `ffmpeg` / `ffprobe` on PATH (for the analysis and check scripts)
- Chrome is downloaded by Remotion on first render

## Gotchas captured in the skill

1. CSS applies `filter` before `clip-path` — blur the parent, clip the child, or a soft spotlight gets razor edges.
2. A "cleanup" full-frame overlay drawn after the content hides the text; the wipe shape already covers the frame.
3. Artwork cropped at the SVG canvas edge shows a hard cut on dark backgrounds — mask with a gradient that is fully transparent for the first ~4%.
4. `url(#gradient)` fills render black without their `<defs>`; the SVG script swaps them for the first stop colour.
5. Per-path transforms in inline SVG need `transformBox: "fill-box"`, or scale/rotate pivots on the canvas origin.

## Credits

- `references/remotion-rules/` are copied unchanged from [remotion-dev/skills](https://github.com/remotion-dev/skills) (the `remotion-best-practices` skill, also installable with `npx skills add remotion-dev/skills`). They remain the work of the Remotion team; see that repository for their terms.
- Everything else in this repo is released under the MIT License (see `LICENSE`).
````
