Skip to content

🎥 Make videos programmatically with React

Rewrite skills (#9838)

Jonny Burgerd056bebe777b
diff --git a/packages/example/src/MultiSceneSample/ClosingScene.tsx b/packages/example/src/MultiSceneSample/ClosingScene.tsx
new file mode 100644
index 0000000000..339a497ed7
--- /dev/null
+++ b/packages/example/src/MultiSceneSample/ClosingScene.tsx
@@ -0,0 +1,43 @@
+import {
+ AbsoluteFill,
+ Easing,
+ Interactive,
+ interpolate,
+ useCurrentFrame,
+} from 'remotion';
+
+export const ClosingScene: React.FC = () => {
+ const frame = useCurrentFrame();
+
+ return (
+ <AbsoluteFill
+ style={{
+ backgroundColor: '#ecfdf5',
+ justifyContent: 'center',
+ alignItems: 'center',
+ }}
+ >
+ <Interactive.Div
+ name="Closing title"
+ style={{
+ color: '#065f46',
+ fontFamily: 'Arial, sans-serif',
+ fontSize: 104,
+ fontWeight: 700,
+ letterSpacing: -4,
+ opacity: interpolate(frame, [0, 18, 70, 89], [0, 1, 1, 0], {
+ easing: [
+ Easing.bezier(0.16, 1, 0.3, 1),
+ Easing.linear,
+ Easing.bezier(0.7, 0, 0.84, 0),
+ ],
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ }),
+ }}
+ >
+ Ready to remix.
+ </Interactive.Div>
+ </AbsoluteFill>
+ );
+};
diff --git a/packages/example/src/MultiSceneSample/FeatureScene.tsx b/packages/example/src/MultiSceneSample/FeatureScene.tsx
new file mode 100644
index 0000000000..2d8392af01
--- /dev/null
+++ b/packages/example/src/MultiSceneSample/FeatureScene.tsx
@@ -0,0 +1,42 @@
+import {
+ AbsoluteFill,
+ Easing,
+ Interactive,
+ interpolate,
+ useCurrentFrame,
+} from 'remotion';
+
+export const FeatureScene: React.FC = () => {
+ const frame = useCurrentFrame();
+
+ return (
+ <AbsoluteFill
+ style={{
+ backgroundColor: '#f97316',
+ justifyContent: 'center',
+ alignItems: 'center',
+ }}
+ >
+ <Interactive.Div
+ name="Feature card"
+ style={{
+ backgroundColor: '#fff7ed',
+ borderRadius: 36,
+ color: '#7c2d12',
+ fontFamily: 'Arial, sans-serif',
+ fontSize: 88,
+ fontWeight: 700,
+ padding: '54px 72px',
+ scale: interpolate(frame, [0, 24], [0.8, 1], {
+ easing: Easing.spring({damping: 200}),
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ output: 'perceptual-scale',
+ }),
+ }}
+ >
+ Three editable scenes.
+ </Interactive.Div>
+ </AbsoluteFill>
+ );
+};
diff --git a/packages/example/src/MultiSceneSample/MultiSceneVideo.tsx b/packages/example/src/MultiSceneSample/MultiSceneVideo.tsx
new file mode 100644
index 0000000000..a2a485beda
--- /dev/null
+++ b/packages/example/src/MultiSceneSample/MultiSceneVideo.tsx
@@ -0,0 +1,22 @@
+import {TransitionSeries} from '@remotion/transitions';
+import {ClosingScene} from './ClosingScene';
+import {FeatureScene} from './FeatureScene';
+import {OpeningScene} from './OpeningScene';
+
+export const MultiSceneVideo: React.FC = () => {
+ return (
+ <>
+ <TransitionSeries>
+ <TransitionSeries.Sequence durationInFrames={90}>
+ <OpeningScene />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Sequence durationInFrames={90}>
+ <FeatureScene />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Sequence durationInFrames={90}>
+ <ClosingScene />
+ </TransitionSeries.Sequence>
+ </TransitionSeries>
+ </>
+ );
+};
diff --git a/packages/example/src/MultiSceneSample/OpeningScene.tsx b/packages/example/src/MultiSceneSample/OpeningScene.tsx
new file mode 100644
index 0000000000..37157783db
--- /dev/null
+++ b/packages/example/src/MultiSceneSample/OpeningScene.tsx
@@ -0,0 +1,44 @@
+import {
+ AbsoluteFill,
+ Easing,
+ Interactive,
+ interpolate,
+ useCurrentFrame,
+} from 'remotion';
+
+export const OpeningScene: React.FC = () => {
+ const frame = useCurrentFrame();
+
+ return (
+ <AbsoluteFill
+ style={{
+ backgroundColor: '#111827',
+ justifyContent: 'center',
+ alignItems: 'center',
+ }}
+ >
+ <Interactive.Div
+ name="Opening title"
+ style={{
+ color: '#f9fafb',
+ fontFamily: 'Arial, sans-serif',
+ fontSize: 112,
+ fontWeight: 700,
+ letterSpacing: -5,
+ opacity: interpolate(frame, [0, 20], [0, 1], {
+ easing: Easing.bezier(0.16, 1, 0.3, 1),
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ }),
+ translate: interpolate(frame, [0, 20], ['0px 60px', '0px 0px'], {
+ easing: Easing.bezier(0.16, 1, 0.3, 1),
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ }),
+ }}
+ >
+ One video.
+ </Interactive.Div>
+ </AbsoluteFill>
+ );
+};
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index 8f8f7d08a4..ec4cd43e0a 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -103,6 +103,10 @@ import {ManyAudio} from './ManyAudio';
import {HandleAudioRenderError} from './MediaErrorHandling/HandleAudioRenderError';
import {InfiniteAudio} from './MediaErrorHandling/InfiniteAudio';
import {MissingImg} from './MissingImg';
+import {ClosingScene} from './MultiSceneSample/ClosingScene';
+import {FeatureScene} from './MultiSceneSample/FeatureScene';
+import {MultiSceneVideo} from './MultiSceneSample/MultiSceneVideo';
+import {OpeningScene} from './MultiSceneSample/OpeningScene';
import {OffthreadRemoteVideo} from './OffthreadRemoteVideo/OffthreadRemoteVideo';
import {OffthreadVideoToCanvas} from './OffthreadVideoToCanvas';
import {OrbScene} from './Orb';
@@ -2542,6 +2546,40 @@ export const Index: React.FC = () => {
fps={30}
durationInFrames={900}
/>
+ <Folder name="MultiSceneSample-Scenes">
+ <Composition
+ id="MultiSceneSample-Opening"
+ component={OpeningScene}
+ width={1920}
+ height={1080}
+ fps={30}
+ durationInFrames={90}
+ />
+ <Composition
+ id="MultiSceneSample-Feature"
+ component={FeatureScene}
+ width={1920}
+ height={1080}
+ fps={30}
+ durationInFrames={90}
+ />
+ <Composition
+ id="MultiSceneSample-Closing"
+ component={ClosingScene}
+ width={1920}
+ height={1080}
+ fps={30}
+ durationInFrames={90}
+ />
+ </Folder>
+ <Composition
+ id="MultiSceneSample"
+ component={MultiSceneVideo}
+ width={1920}
+ height={1080}
+ fps={30}
+ durationInFrames={270}
+ />
<Composition
id="spring-season"
component={SpringSeason}
diff --git a/packages/skills/skills/remotion-create/SKILL.md b/packages/skills/skills/remotion-create/SKILL.md
index 4eaa00a189..31290b2cb3 100644
--- a/packages/skills/skills/remotion-create/SKILL.md
+++ b/packages/skills/skills/remotion-create/SKILL.md
@@ -25,7 +25,12 @@ Replace `my-video` with a suitable project name.
## Designing a video
-Keep the scaffold and add React Markup. Follow [Remotion React Markup Best Practices](../remotion-markup/SKILL.md) and [Video Layout Rules](video-layout.md) for video-first layout and text sizing guidance.
+Keep the scaffold and add React Markup.
+Follow [Remotion React Markup Best Practices](../remotion-markup/SKILL.md) and [Video Layout Rules](video-layout.md) for video-first layout and text sizing guidance.
+
+## Is this a multi-scene video?
+
+If this is a video with multiple subsequence videos, follow guidance at [Multi-scene videos](../remotion-markup/multi-scene-video.md).
## Interactivity Best Practices
diff --git a/packages/skills/skills/remotion-markup/SKILL.md b/packages/skills/skills/remotion-markup/SKILL.md
index 9cc4a7964d..03f869c50d 100644
--- a/packages/skills/skills/remotion-markup/SKILL.md
+++ b/packages/skills/skills/remotion-markup/SKILL.md
@@ -10,10 +10,11 @@ If this is not relevant, load [Remotion Best Practices](../remotion-best-practic
## General rules
-Animate properties using `useCurrentFrame()` and `interpolate()`.
+Drive animations using `useCurrentFrame()` and `interpolate()`.
+CSS `transition` or `animation` will not render correctly, they need to refactored.
+Tailwind animation class will not render correctly, they need to be refactored.
-Use `Easing.bezier()` to customize timing, including jumpy or overshooting motion.
-Use `Easing.spring()` if you want spring animations.
+Use `Easing.bezier()` and `Easing.spring()` to customize timing.
Structure your markup according to [Remotion Interactivity Best Practices](../remotion-interactivity/SKILL.md)
@@ -27,7 +28,7 @@ export const FadeIn = () => {
<Interactive.Div
name="Title"
style={{
- opacity: interpolate(frame, [0, 60], [0, 1], {
+ opacity: interpolate(frame, [0, 2 * fps], [0, 1], {
extrapolateRight: "clamp",
extrapolateLeft: "clamp",
easing: Easing.bezier(0.16, 1, 0.3, 1),
@@ -41,7 +42,7 @@ export const FadeIn = () => {
```
Keep the `interpolate()` call inline in the `style` prop.
-Prefer `scale`, `translate`, `rotate` CSS properties over `transform`.
+Use `scale`, `translate`, `rotate` CSS properties over `transform`.
```tsx
// 👍 Inline editable keyframes and transform shorthands
@@ -64,7 +65,7 @@ style={{
}),
}}
-// 👎 Hidden values and transform strings become harder to edit in Studio
+// 👎 Non-inline values and transform strings become harder to edit in Studio
const scale = interpolate(frame, [0, 100], [0, 1]);
style={{
@@ -72,20 +73,21 @@ style={{
}}
```
-CSS transitions or animations are FORBIDDEN - they will not render correctly.
-Tailwind animation class names are FORBIDDEN - they will not render correctly.
+## Assets
Place assets in the `public/` folder at your project root.
-
Use `staticFile()` to reference files from the `public/` folder.
-Add video and audio using `@remotion/media`.
+## Media components
+
+Add video and audio using `<Video>` and `<Audio>` from `@remotion/media`.
Add images using the `<CanvasImage>` component.
+Add animated GIFs, APNG, WebP or AVIF images using `<AnimatedImage>`, use `@remotion/gif` if not using Chrome.
Use `staticFile()` for files in `public/` or pass a remote URL directly:
```tsx
import { Audio, Video } from "@remotion/media";
-import { staticFile, CanvasImage } from "remotion";
+import { staticFile, CanvasImage, AnimatedImage } from "remotion";
export const MyComposition = () => {
return (
@@ -94,108 +96,131 @@ export const MyComposition = () => {
<Audio src={staticFile("audio.mp3")} />
<CanvasImage src={staticFile("logo.png")} style={{ width: 100, height: 100 }} />
<Video src="https://remotion.media/video.mp4" />
+ <AnimatedImage src={staticFile('nyancat.gif')} />
</>
);
};
```
-## Cropping
-
-See [cropping.md](cropping.md) for supported components, crop props, Studio
-controls, animation, and custom component support.
-
-To delay content wrap it in `<Sequence>` and use `from`.
-To limit the duration of an element, use `durationInFrames` of `<Sequence>`.
-`<Sequence>` by default is an absolute fill covering the scene.
-For inline content, use `layout="none"`.
+## Example scene
```tsx
-const Main = () => {
+import {
+ AbsoluteFill,
+ Easing,
+ Interactive,
+ interpolate,
+ useCurrentFrame,
+ useVideoConfig
+} from "remotion";
+
+export const Empty = () => {
const {fps} = useVideoConfig();
+ const frame = useCurrentFrame();
return (
- <AbsoluteFill>
- <Background />
- <AbsoluteFill>
- <Sequence name="Title" from={30} durationInFrames={60} layout="none">
- <Title />
- </Sequence>
- <Sequence name="Subtitle" from={60} durationInFrames={60} layout="none">
- <Subtitle />
- </Sequence>
- </AbsoluteFill>
+ <AbsoluteFill style={{display: 'flex', justifyContent: 'center', alignItems: 'center'}}>
+ <Interactive.Div
+ name="Title"
+ style={{
+ opacity: interpolate(frame, [1 * fps, 2 * fps], [0, 1], {
+ extrapolateRight: "clamp",
+ extrapolateLeft: "clamp",
+ easing: Easing.bezier(0.16, 1, 0.3, 1),
+ }),
+ fontSize: 88
+ }}
+ >
+ Title
+ </Interactive.Div>
+ <Interactive.Div
+ name="Subtitle"
+ style={{
+ opacity: interpolate(frame, [2 * fps, 3 * fps, 8 * fps, 10 * fps], [0, 1, 1, 0], {
+ extrapolateRight: "clamp",
+ extrapolateLeft: "clamp",
+ easing: [Easing.bezier(0.16, 1, 0.3, 1), Easing.linear, Easing.bezier(0.16, 1, 0.3, 1)],
+ }),
+ fontSize: 32
+ }}
+ >
+ Subtitle
+ </Interactive.Div>
</AbsoluteFill>
);
}
+```
-export const Title = () => {
- const frame = useCurrentFrame();
+## Delaying, trimming
- return (
- <Interactive.Div
- name="Label"
- style={{
- opacity: interpolate(frame, [0, 60], [0, 1], {
- extrapolateRight: "clamp",
- extrapolateLeft: "clamp",
- easing: Easing.bezier(0.16, 1, 0.3, 1),
- }),
- fontSize: 88
- }}
- >
- Title
- </Interactive.Div>
- );
-};
+Most components (`<Interactive.*>` `<Img>`, `<AnimatedImage>`, `<CanvasImage>`, `<HtmlInCanvas>`, `<Solid>`, `<Sequence>` from `remotion`, `<Video>` and `<Audio>` from `@remotion/media`, `<Gif>`, and more) support the following props:
-export const Subtitle = () => {
- const frame = useCurrentFrame();
+### from
- return (
- <Interactive.Div
- name="Subtitle"
- style={{
- opacity: interpolate(frame, [0, 60], [0, 1], {
- extrapolateRight: "clamp",
- extrapolateLeft: "clamp",
- easing: Easing.bezier(0.16, 1, 0.3, 1),
- }),
- fontSize: 32
- }}
- >
- Subtitle
- </Interactive.Div>
- );
-};
+```tsx
+<Img from={1 * fps} {/* ... */}/>
+<Video from={1 * fps} {/* ... */}/>
+<Interactive.Div from={1 * fps} {/* ... */}/>
+```
+
+When the element starts appearing in the timelien.
+
+### durationInFrames
+
+```tsx
+<Img durationInFrames={20 * fps} {/* ... */}/>
+<Interactive.Div durationInFrames={20 * fps} {/* ... */}/>
+```
+
+For how long the layer plays in the timeline.
+For media, pass the natural duration of the media: `<Video durationInFrames={29.322 * fps}/>`
+
+### `trimBefore`
+
+Useful for components whose internal clock should start later:
+
+```tsx
+<Video trimBefore={2 * fps} {/* ... */} /> // Trim away first 2 seconds of footage
+<Sequence trimBefore={10 * fps} {/* ... */} /> // `useCurrenFrame()` for children starts at `10 * fps`
```
+### Fallback
+
+If a component does not support these props, wrap it in`<Sequence>` from `remotion`, which has them.
+- `layout="absolute-fill"` makes the Sequence behave like AbsoluteFill
+- `layout="none"` is "headless" mode, no wrapper element is used.
+
## Maps
-See [Remotion Maps](remotion-maps/SKILL.md) for choosing a map technique.
+See [Remotion Maps](remotion-maps/SKILL.md) if wanting to include maps in the video.
## Text highlights and annotations
-See [text-highlights.md](text-highlights.md) for text highlights (highlight markers), circles, underlines, strike-throughs, crossed-off text, boxes, and brackets.
+See [text-highlights.md](text-highlights.md) for text highlights (highlight markers), circles, underlines, strike-throughs, crossed-off text, boxes.
-## Voiceover
+## Multi-scene videos
-See [voiceover.md](voiceover.md) for adding AI-generated voiceover to Remotion compositions using ElevenLabs TTS.
+See [multi-scene-video.md](multi-scene-video.md) if planning to make a video with multiple subsequent scenes.
-## Trimming
+## Voiceover
-See [trimming.md](trimming.md) for trimming patterns - cutting the beginning or end of animations.
+See [voiceover.md](voiceover.md) for adding an AI-generated voiceover to Remotion compositions using ElevenLabs TTS.
## Embedding Videos
See [embedding-videos.md](embedding-videos.md) for advanced knowledge about embedding videos - trimming, volume, speed, looping, pitch.
+## Embedding Audio
+
+See [audio.md](audio.md) for advanced audio features like trimming, volume, speed, pitch.
+
## Video editing
See [video-editing.md](video-editing.md) for structuring editable video timelines in Remotion Studio.
-## Embedding Audio
+## Cropping
-See [audio.md](audio.md) for advanced audio features like trimming, volume, speed, pitch.
+See [cropping.md](cropping.md) if needing to crop the visible rectangle of a component.
## Transitions
@@ -203,9 +228,10 @@ See [transitions.md](transitions.md) for scene transition patterns.
## Visual and pixel effects
-When creating a visual effect, consider whether it is feasible using CSS and HTML, or whether a shader is needed. Order or preference:
+When creating a visual effect, consider whether it is feasible using CSS and HTML, or whether a shader is needed.
+Order or preference:
-1. Normal Remotion/HTML/CSS/SVG/filter/blend/mask animation
+1. Regular HTML + CSS or other web techniques
2. An effect applied to the element directly (`<Video>`, `<Img>`), or by wrapping the content in [`<HtmlInCanvas>`](html-in-canvas.md), which also accepts `effects`:
- A listed effect via [effects.md](effects.md)
@@ -213,7 +239,7 @@ When creating a visual effect, consider whether it is feasible using CSS and HTM
## 3D content
-See [3d.md](3d.md) for 3D content in Remotion using Three.js and React Three Fiber.
+See [./3d.md](./3d.md) for 3D content in Remotion using Three.js and React Three Fiber.
## Sound effects
@@ -251,9 +277,9 @@ See [images.md](images.md) for sizing and positioning images, dynamic image path
See [lottie.md](lottie.md) for embedding Lottie animations in Remotion.
-## Advanced timing
+## Timing
-See [timing.md](timing.md) for advanced timing with `interpolate` and Bézier easing, and springs.
+See [timing.md](timing.md) for more timing techniques for `interpolate()`.
## Parameterized videos
@@ -299,6 +325,10 @@ This goes for `@remotion/*` packages, `mediabunny`, `@mediabunny/*`, and `zod`.
## Previewing markup
+```
+npx remotion studio --no-open
+```
+
This will start a long-running process and print the server URL for the preview.
If server is already started, it will print the URL.
You can visit a specific composition by navigating to `/[composition-id]`, for example `http://localhost:3000/MapAnimation`.
diff --git a/packages/skills/skills/remotion-markup/multi-scene-video.md b/packages/skills/skills/remotion-markup/multi-scene-video.md
new file mode 100644
index 0000000000..cffe91e564
--- /dev/null
+++ b/packages/skills/skills/remotion-markup/multi-scene-video.md
@@ -0,0 +1,75 @@
+If the video being created is a multi-scene video, it should be structured in a special way.
+Create a new folder and put each scene in a separate file.
+
+```tsx
+// SceneA.tsx
+export const SceneA: React.FC = () => {
+ return // ...
+}
+```
+
+```tsx
+// SceneB.tsx
+export const SceneB: React.FC = () => {
+ return // ...
+}
+```
+
+// MyVideo.tsx
+```tsx
+import {TransitionSeries} from '@remotion/transitions';
+
+const MyVideo: React.FC = () => {
+ return (
+ <TransitionSeries>
+ <TransitionSeries.Sequence durationInFrames={4 * fps}>
+ <SceneA />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Sequence durationInFrames={4 * fps}>
+ <SceneB />
+ </TransitionSeries.Sequence>
+ </TransitionSeries>
+ )
+}
+```
+
+It could also make sense to register each scene individually in the root file so it can be edited there.
+If a composition with the same component is registered, one can double click the sequence in the main composition and jump to that composition.
+
+```tsx
+export const Root: React.FC = () => {
+ return (
+ <>
+ <Folder id="MyVideo-Scenes">
+ <Composition
+ id="Scene1"
+ component={Scene1}
+ durationInFrames={5 * fps}
+ fps={30}
+ width={1920}
+ height={1080}
+ />
+ <Composition
+ id="Scene2"
+ component={Scene2}
+ durationInFrames={5 * fps}
+ fps={30}
+ width={1920}
+ height={1080}
+ />
+ </Folder>
+ <Composition
+ id="MyVideo"
+ component={MyVideo}
+ durationInFrames={10 * fps}
+ fps={30}
+ width={1920}
+ height={1080}
+ />
+ </>
+ )
+}
+```
+
+This allows the user to trim the start and end of the durations visually and add [transitions](./transitions.md) later.
+Prefer inlining the `durationInFrames` values, because only then they are editable. It's okay if the value is redundant.
diff --git a/packages/skills/skills/remotion-markup/timing.md b/packages/skills/skills/remotion-markup/timing.md
index d76c456c35..4c224f8de0 100644
--- a/packages/skills/skills/remotion-markup/timing.md
+++ b/packages/skills/skills/remotion-markup/timing.md
@@ -1,25 +1,19 @@
----
-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 an explicit frame range. Prefer `interpolate()` over `spring()` unless the user explicitly asks for physics-based motion. To customize timing, use **`Easing.bezier`**. The four parameters are the same as CSS `cubic-bezier(x1, y1, x2, y2)`.
+Drive motion with `interpolate()` over an explicit frame range.
+To customize timing, use **`Easing.bezier`** or `Easing.spring`.
A simple linear interpolation is done using the `interpolate` function.
-```ts title="Going from 0 to 1 over 100 frames"
+```ts title="Going from 0 to 1 over 0.3 seconds"
import { interpolate } from "remotion";
-const opacity = interpolate(frame, [0, 100], [0, 1]);
+const opacity = interpolate(frame, [0, 0.3 * fps], [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], {
+```ts title="Going from 0 to 1 over 0.3 seconds with extrapolation"
+const opacity = interpolate(frame, [0, 0.3 * fps], [0, 1], {
extrapolateRight: "clamp",
extrapolateLeft: "clamp",
});
@@ -48,105 +42,70 @@ style={{
Use `transform` strings only when individual CSS transform properties do not cover the effect, such as `skew()`, `perspective()`, or order-sensitive multi-transform chains.
-## Bézier easing
+## Spring 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.
+A nice push movement with no bounce:
```ts
import { interpolate, Easing } from "remotion";
-const opacity = interpolate(frame, [0, 60], [0, 1], {
- easing: Easing.bezier(0.16, 1, 0.3, 1),
+const opacity = interpolate(frame, [0, 0.3 * fps], [0, 1], {
+ easing: Easing.spring({damping: 200}),
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
});
```
-### Examples (copy-paste curves)
+## Bézier easing
-**1. Crisp UI entrance (strong ease-out, no overshoot)** — slows nicely into the rest value; similar to many system “deceleration” curves.
+Pass values like you would to a CSS cubic-bezier function.
-```tsx
-const enter = interpolate(frame, [0, 45], [0, 1], {
+```ts
+import { interpolate, Easing } from "remotion";
+
+const opacity = interpolate(frame, [0, 0.3 * fps], [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.
+## Animating scale
-```tsx
-const progress = interpolate(frame, [0, 90], [0, 1], {
- easing: Easing.bezier(0.45, 0, 0.55, 1),
+When animating scale, if the output is linear, the perceived scale would be smaller the larger the scale gets.
+Use this option to compensate:
+
+```ts
+const scale = interpolate(frame, [0, 0.3 * fps], [0, 1], {
+ easing: Easing.bezier(0.16, 1, 0.3, 1),
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
+ output: 'perceptual-scale' // <- Add this to scale animations
});
```
-**3. Playful overshoot (control point y > 1)** — a little past the target then settles; use sparingly for emphasis.
+## Multiple keyframes
-```tsx
-const pop = interpolate(frame, [0, 30], [0, 1], {
- easing: Easing.bezier(0.34, 1.56, 0.64, 1),
+Add as many keyframes as you want. For multiple easings, pass an array with `n - 1` items:
+
+```ts
+const scale = interpolate(frame, [0, 1 * fps, 9 * fps, 10 * fps], [0, 1, 1, 0], {
+ easing: [Easing.bezier(0.16, 1, 0.3, 1), Easing.linear, Easing.spring({damping: 200})],
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
+ output: 'perceptual-scale' // <- Add this to scale animations
});
```
-## Studio-editable easing curves
+## Posterization
-Use an explicit `Easing.bezier()` curve instead of composed presets such as `Easing.inOut(Easing.cubic)`. Explicit Bézier control points remain editable in Remotion Studio.
+You can intentionally reduce the frame rate for artistic reason. Use if it makes sense.
```ts
-import { interpolate, Easing } from "remotion";
-
-const value1 = interpolate(frame, [0, 100], [0, 1], {
- easing: Easing.bezier(0.645, 0.045, 0.355, 1),
+const scale = interpolate(frame, [0, 1 * fps], [0, 1], {
+ easing: Easing.bezier(0.16, 1, 0.3, 1),
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
+ posterize: 3 // Only every 3rd frame is sampled
});
```
-
-The default easing is `Easing.linear`.
-
-### Easing direction for enter/exit animations
-
-Use an ease-out Bézier curve for enter animations (starts fast, decelerates into place) and an ease-in Bézier curve 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 and do not need Studio keyframe editing (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.bezier(0.333, 0, 0.667, 0),
- 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).
-
-If the values should be visually keyframed in Studio, prefer inline `interpolate()` calls in the relevant style props, even if it duplicates the timing.
diff --git a/packages/skills/skills/remotion-markup/trimming.md b/packages/skills/skills/remotion-markup/trimming.md
deleted file mode 100644
index e7534d1ce6..0000000000
--- a/packages/skills/skills/remotion-markup/trimming.md
+++ /dev/null
@@ -1,51 +0,0 @@
----
-name: trimming
-description: Trimming patterns for Remotion - cut the beginning or end of animations
-metadata:
- tags: sequence, trim, clip, cut, offset
----
-
-Use `<Sequence>` with a negative `from` value to trim the start of an animation.
-
-## Trim the Beginning
-
-A negative `from` value shifts time backwards, making the animation start partway through:
-
-```tsx
-import { Sequence, useVideoConfig } from "remotion";
-
-const fps = useVideoConfig();
-
-<Sequence from={-0.5 * fps}>
- <MyAnimation />
-</Sequence>;
-```
-
-The animation appears 15 frames into its progress - the first 15 frames are trimmed off.
-Inside `<MyAnimation>`, `useCurrentFrame()` starts at 15 instead of 0.
-
-## Trim the End
-
-Use `durationInFrames` to unmount content after a specified duration:
-
-```tsx
-<Sequence durationInFrames={1.5 * fps}>
- <MyAnimation />
-</Sequence>
-```
-
-The animation plays for 45 frames, then the component unmounts.
-
-## Trim and Delay
-
-Nest sequences to both trim the beginning and delay when it appears:
-
-```tsx
-<Sequence from={30}>
- <Sequence from={-15}>
- <MyAnimation />
- </Sequence>
-</Sequence>
-```
-
-The inner sequence trims 15 frames from the start, and the outer sequence delays the result by 30 frames.