🎥 Make videos programmatically with React
@remotion/skills: Refocus timing rule on Bézier easing over springs
JonnyBurger673747a44e28
diff --git a/packages/skills/skills/remotion/SKILL.md b/packages/skills/skills/remotion/SKILL.mdindex 2eac85eb7f..f2c26c1cdd 100644--- a/packages/skills/skills/remotion/SKILL.md+++ b/packages/skills/skills/remotion/SKILL.md@@ -66,7 +66,7 @@ Read individual rule files for detailed explanations and code examples:- [rules/sequencing.md](rules/sequencing.md) - Sequencing patterns for Remotion - delay, trim, limit duration of items- [rules/tailwind.md](rules/tailwind.md) - Using TailwindCSS in Remotion- [rules/text-animations.md](rules/text-animations.md) - Typography and text animation patterns for Remotion-- [rules/timing.md](rules/timing.md) - Interpolation curves in Remotion - linear, easing, spring animations+- [rules/timing.md](rules/timing.md) - Timing with interpolate and Bézier easing; springs as a specialized option- [rules/transitions.md](rules/transitions.md) - Scene transition patterns for Remotion- [rules/transparent-videos.md](rules/transparent-videos.md) - Rendering out a video with transparency- [rules/trimming.md](rules/trimming.md) - Trimming patterns for Remotion - cut the beginning or end of animationsdiff --git a/packages/skills/skills/remotion/rules/animations.md b/packages/skills/skills/remotion/rules/animations.mdindex 619591e8e6..b8541b5277 100644--- a/packages/skills/skills/remotion/rules/animations.md+++ b/packages/skills/skills/remotion/rules/animations.md@@ -8,6 +8,8 @@ metadata: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).+```tsximport { useCurrentFrame } from "remotion";diff --git a/packages/skills/skills/remotion/rules/timing.md b/packages/skills/skills/remotion/rules/timing.mdindex e85416ecf1..b5654c4ef4 100644--- a/packages/skills/skills/remotion/rules/timing.md+++ b/packages/skills/skills/remotion/rules/timing.md@@ -1,10 +1,14 @@---name: timing-description: Interpolation curves in Remotion - linear, easing, spring animations+description: Interpolation and timing in Remotion—prefer interpolate with Bézier easing; springs as a specialized optionmetadata:- tags: spring, bounce, easing, interpolation+ tags: easing, bezier, interpolation, spring, timing---+**Default approach:** drive motion with `interpolate()` over explicit frame ranges and pass an easing function—especially **`Easing.bezier`**. The four parameters are the same as CSS `cubic-bezier(x1, y1, x2, y2)`, so you can copy curves from browser devtools, motion libraries, or editors like [cubic-bezier.com](https://cubic-bezier.com). That makes duration predictable, keeps key moments aligned to audio or edits, and avoids guessing spring mass/damping/stiffness.++`spring()` is still valid for bouncy, physics-like overshoot when you want that specific feel; it is just a weaker default for **timing design** because settle time is implicit and curves are harder to match to external specs or CSS.+A simple linear interpolation is done using the `interpolate` function.```ts title="Going from 0 to 1 over 100 frames"@@ -23,12 +27,121 @@ const opacity = interpolate(frame, [0, 100], [0, 1], {});```-## Spring animations+## Bézier easing (recommended)++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).-Spring animations have a more natural motion.-They go from 0 to 1 over time.+## Spring animations (specialized)-```ts title="Spring animation from 0 to 1 over 100 frames"+Spring animations model physical damping and stiffness; they read as organic and can overshoot without hand-tuning a Bézier past 1.++```ts title="Spring animation from 0 to 1"import { spring, useCurrentFrame, useVideoConfig } from "remotion";const frame = useCurrentFrame();@@ -85,16 +198,16 @@ A `spring()` has a natural duration based on the physical properties.To stretch the animation to a specific duration, use the `durationInFrames` parameter.```tsx-const spring = spring({+const springValue = spring({frame,fps,durationInFrames: 40,});```-### Combining spring() with interpolate()+### Combining `spring()` with `interpolate()`-Map spring output (0-1) to custom ranges:+Map spring output (0–1) to custom ranges:```tsxconst springProgress = spring({@@ -102,7 +215,6 @@ const springProgress = spring({fps,});-// Map to rotationconst rotation = interpolate(springProgress, [0, 1], [0, 360]);<div style={{ rotate: rotation + "deg" }} />;@@ -130,82 +242,4 @@ const outAnimation = spring({const scale = inAnimation - outAnimation;```-## Easing--Easing can be added to the `interpolate` function:--```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`.-There are various other convexities:--- `Easing.in` for starting slow and accelerating-- `Easing.out` for starting fast and slowing down-- `Easing.inOut`--and curves (sorted from most linear to most curved):--- `Easing.quad`-- `Easing.cubic` (recommended default)-- `Easing.sin`-- `Easing.exp`-- `Easing.circle`--Convexities and curves need be combined for an easing function:--```ts-const value1 = interpolate(frame, [0, 100], [0, 1], {- easing: Easing.inOut(Easing.cubic),- extrapolateLeft: "clamp",- extrapolateRight: "clamp",-});-```--Cubic bezier curves are also supported:--```ts-const value1 = interpolate(frame, [0, 100], [0, 1], {- easing: Easing.bezier(0.8, 0.22, 0.96, 0.65),- extrapolateLeft: "clamp",- extrapolateRight: "clamp",-});-```--### 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.--## 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.out(Easing.cubic), 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]);-```--This pattern works with both `interpolate` and `spring`. The key idea: separate **timing** (when and how fast) from **mapping** (what values to animate between).+Use springs when the brief calls for **physics-like** motion; use **`interpolate` + `Easing.bezier`** when the brief calls for **designed** timing that should stay easy to tweak, document, and match elsewhere.