Skip to content

Commit 514fcd2

Browse files
committed
Update template
1 parent 41a3b06 commit 514fcd2

13 files changed

Lines changed: 448 additions & 820 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"name": "@remotion/skills",
99
"private": true,
10-
"version": "4.0.447",
10+
"version": "4.0.455",
1111
"devDependencies": {
1212
"@remotion/eslint-config-internal": "^4.0.0",
1313
"eslint": "catalog:",

skills/remotion/SKILL.md

Lines changed: 276 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,181 @@ npx create-video@latest --yes --blank --no-tailwind my-video
1919

2020
Replace `my-video` with a suitable project name.
2121

22+
## Designing a video
23+
24+
Animate properties using `useCurrentFrame()` and `interpolate()`. Use Easing to customize the timing of the animation.
25+
26+
```tsx
27+
import { useCurrentFrame, Easing } from "remotion";
28+
29+
export const FadeIn = () => {
30+
const frame = useCurrentFrame();
31+
const { fps } = useVideoConfig();
32+
33+
const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {
34+
extrapolateRight: "clamp",
35+
extrapolateLeft: "clamp",
36+
easing: Easing.bezier(0.16, 1, 0.3, 1),
37+
});
38+
39+
return <div style={{ opacity }}>Hello World!</div>;
40+
};
41+
```
42+
43+
CSS transitions or animations are FORBIDDEN - they will not render correctly.
44+
Tailwind animation class names are FORBIDDEN - they will not render correctly.
45+
46+
Place assets in the `public/` folder at your project root.
47+
48+
Use `staticFile()` to reference files from the `public/` folder.
49+
50+
Add images using the `<Img>` component:
51+
52+
```tsx
53+
import { Img, staticFile } from "remotion";
54+
55+
export const MyComposition = () => {
56+
return <Img src={staticFile("logo.png")} style={{ width: 100, height: 100 }} />;
57+
};
58+
```
59+
60+
Add videos using the `<Video>` component from `@remotion/media`:
61+
62+
```tsx
63+
import { Video } from "@remotion/media";
64+
import { staticFile } from "remotion";
65+
66+
export const MyComposition = () => {
67+
return <Video src={staticFile("video.mp4")} style={{ opacity: 0.5 }} />;
68+
};
69+
```
70+
71+
Add audio using the `<Audio>` component from `@remotion/media`:
72+
73+
```tsx
74+
import { Audio } from "@remotion/media";
75+
import { staticFile } from "remotion";
76+
77+
export const MyComposition = () => {
78+
return <Audio src={staticFile("audio.mp3")} />;
79+
};
80+
```
81+
82+
Assets can be also referenced as remote URLs:
83+
84+
```tsx
85+
import { Video } from "@remotion/media";
86+
87+
export const MyComposition = () => {
88+
return <Video src="https://remotion.media/video.mp4" />
89+
};
90+
```
91+
92+
To delay content wrap it in `<Sequence>` and use `from`.
93+
To limit the duration of an element, use `durationInFrames` of `<Sequence>`.
94+
`<Sequence>` by default is an absolute fill. For inline content, use `layout="none"`.
95+
96+
```tsx
97+
import { Sequence } from "remotion";
98+
99+
export const Title = () => {
100+
const frame = useCurrentFrame();
101+
const { fps } = useVideoConfig();
102+
103+
const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {
104+
extrapolateRight: "clamp",
105+
extrapolateLeft: "clamp",
106+
easing: Easing.bezier(0.16, 1, 0.3, 1),
107+
});
108+
109+
return <div style={{ opacity }}>Title</div>;
110+
};
111+
112+
export const Subtitle = () => {
113+
return <div>Subtitle</div>;
114+
};
115+
116+
const Main = () => {
117+
const {fps} = useVideoConfig();
118+
119+
return (
120+
<AbsoluteFill>
121+
<Sequence>
122+
<Background />
123+
</Sequence>
124+
<Sequence from={1 * fps} durationInFrames={2 * fps} layout="none">
125+
<Title />
126+
</Sequence>
127+
<Sequence from={2 * fps} durationInFrames={2 * fps} layout="none">
128+
<Subtitle />
129+
</Sequence>
130+
</AbsoluteFill>
131+
);
132+
}
133+
```
134+
135+
The width, height, fps, and duration of a video is defined in `src/Root.tsx`:
136+
137+
```tsx
138+
import { Composition } from "remotion";
139+
import { MyComposition } from "./MyComposition";
140+
141+
export const RemotionRoot = () => {
142+
return (
143+
<Composition
144+
id="MyComposition"
145+
component={MyComposition}
146+
durationInFrames={100}
147+
fps={30}
148+
width={1080}
149+
height={1080}
150+
/>
151+
);
152+
};
153+
```
154+
155+
Metadata can also be calculated dynamically:
156+
157+
```tsx
158+
import { Composition, CalculateMetadataFunction } from "remotion";
159+
import { MyComposition, MyCompositionProps } from "./MyComposition";
160+
161+
const calculateMetadata: CalculateMetadataFunction<
162+
MyCompositionProps
163+
> = async ({ props, abortSignal }) => {
164+
const data = await fetch(`https://api.example.com/video/${props.videoId}`, {
165+
signal: abortSignal,
166+
}).then((res) => res.json());
167+
168+
return {
169+
durationInFrames: Math.ceil(data.duration * 30),
170+
props: {
171+
...props,
172+
videoUrl: data.url,
173+
},
174+
width: 1080,
175+
height: 1080,
176+
};
177+
};
178+
179+
export const RemotionRoot = () => {
180+
return (
181+
<Composition
182+
id="MyComposition"
183+
component={MyComposition}
184+
fps={30}
185+
width={1080}
186+
height={1080}
187+
defaultProps={{ videoId: "abc123" }}
188+
calculateMetadata={calculateMetadata}
189+
/>
190+
);
191+
};
192+
```
193+
22194
## Starting preview
23195

24-
Stsrt the Remotion Studio to preview a video:
196+
Start the Remotion Studio to preview a video:
25197

26198
```bash
27199
npx remotion studio
@@ -58,38 +230,106 @@ When needing to visualize audio (spectrum bars, waveforms, bass-reactive effects
58230

59231
When needing to use sound effects, load the [./rules/sfx.md](./rules/sfx.md) file for more information.
60232

61-
## How to use
62-
63-
Read individual rule files for detailed explanations and code examples:
64-
65-
- [rules/3d.md](rules/3d.md) - 3D content in Remotion using Three.js and React Three Fiber
66-
- [rules/animations.md](rules/animations.md) - Fundamental animation skills for Remotion
67-
- [rules/assets.md](rules/assets.md) - Importing images, videos, audio, and fonts into Remotion
68-
- [rules/audio.md](rules/audio.md) - Using audio and sound in Remotion - importing, trimming, volume, speed, pitch
69-
- [rules/calculate-metadata.md](rules/calculate-metadata.md) - Dynamically set composition duration, dimensions, and props
70-
- [rules/can-decode.md](rules/can-decode.md) - Check if a video can be decoded by the browser using Mediabunny
71-
- [rules/charts.md](rules/charts.md) - Chart and data visualization patterns for Remotion (bar, pie, line, stock charts)
72-
- [rules/compositions.md](rules/compositions.md) - Defining compositions, stills, folders, default props and dynamic metadata
73-
- [rules/extract-frames.md](rules/extract-frames.md) - Extract frames from videos at specific timestamps using Mediabunny
74-
- [rules/fonts.md](rules/fonts.md) - Loading Google Fonts and local fonts in Remotion
75-
- [rules/get-audio-duration.md](rules/get-audio-duration.md) - Getting the duration of an audio file in seconds with Mediabunny
76-
- [rules/get-video-dimensions.md](rules/get-video-dimensions.md) - Getting the width and height of a video file with Mediabunny
77-
- [rules/get-video-duration.md](rules/get-video-duration.md) - Getting the duration of a video file in seconds with Mediabunny
78-
- [rules/gifs.md](rules/gifs.md) - Displaying GIFs synchronized with Remotion's timeline
79-
- [rules/images.md](rules/images.md) - Embedding images in Remotion using the Img component
80-
- [rules/light-leaks.md](rules/light-leaks.md) - Light leak overlay effects using @remotion/light-leaks
81-
- [rules/lottie.md](rules/lottie.md) - Embedding Lottie animations in Remotion
82-
- [rules/measuring-dom-nodes.md](rules/measuring-dom-nodes.md) - Measuring DOM element dimensions in Remotion
83-
- [rules/measuring-text.md](rules/measuring-text.md) - Measuring text dimensions, fitting text to containers, and checking overflow
84-
- [rules/sequencing.md](rules/sequencing.md) - Sequencing patterns for Remotion - delay, trim, limit duration of items
85-
- [rules/tailwind.md](rules/tailwind.md) - Using TailwindCSS in Remotion
86-
- [rules/text-animations.md](rules/text-animations.md) - Typography and text animation patterns for Remotion
87-
- [rules/timing.md](rules/timing.md) - Timing with interpolate and Bézier easing, springs
88-
- [rules/transitions.md](rules/transitions.md) - Scene transition patterns for Remotion
89-
- [rules/transparent-videos.md](rules/transparent-videos.md) - Rendering out a video with transparency
90-
- [rules/trimming.md](rules/trimming.md) - Trimming patterns for Remotion - cut the beginning or end of animations
91-
- [rules/videos.md](rules/videos.md) - Embedding videos in Remotion - trimming, volume, speed, looping, pitch
92-
- [rules/parameters.md](rules/parameters.md) - Make a video parametrizable by adding a Zod schema
93-
- [rules/maps.md](rules/maps.md) - Add a map using Mapbox and animate it
94-
- [rules/silence-detection.md](rules/silence-detection.md) - Adaptive silence detection using FFmpeg loudnorm and silencedetect
95-
- [rules/voiceover.md](rules/voiceover.md) - Adding AI-generated voiceover to Remotion compositions using ElevenLabs TTS
233+
## 3D content
234+
235+
See [rules/3d.md](rules/3d.md) for 3D content in Remotion using Three.js and React Three Fiber.
236+
237+
## Advanced audio
238+
239+
See [rules/audio.md](rules/audio.md) for advanced audio features like trimming, volume, speed, pitch.
240+
241+
## Dynamic duration, dimensions and data
242+
243+
See [rules/calculate-metadata.md](rules/calculate-metadata.md) for dynamically set composition duration, dimensions, and props.
244+
245+
## Advanced compositions
246+
247+
See [rules/compositions.md](rules/compositions.md) for how to define stills, folders, default props and for how to nest compositions.
248+
249+
## Google Fonts
250+
251+
Is the recommended way to load fonts in Remotion. See [rules/google-fonts.md](rules/google-fonts.md) for how to load Google Fonts.
252+
253+
## Local fonts
254+
255+
See [rules/local-fonts.md](rules/local-fonts.md) for how to load local fonts.
256+
257+
## Getting audio duration
258+
259+
See [rules/get-audio-duration.md](rules/get-audio-duration.md) for getting the duration of an audio file in seconds with Mediabunny.
260+
261+
## Getting video dimensions
262+
263+
See [rules/get-video-dimensions.md](rules/get-video-dimensions.md) for getting the width and height of a video file with Mediabunny.
264+
265+
## Getting video duration
266+
267+
See [rules/get-video-duration.md](rules/get-video-duration.md) for getting the duration of a video file in seconds with Mediabunny.
268+
269+
## GIFs
270+
271+
See [rules/gifs.md](rules/gifs.md) for how to display GIFs synchronized with Remotion's timeline.
272+
273+
## Advanced Images
274+
275+
See [rules/images.md](rules/images.md) for sizing and positioning images, dynamic image paths, and getting image dimensions.
276+
277+
## Light leaks
278+
279+
See [rules/light-leaks.md](rules/light-leaks.md) for light leak overlay effects using `@remotion/light-leaks`.
280+
281+
## Lottie animations
282+
283+
See [rules/lottie.md](rules/lottie.md) for embedding Lottie animations in Remotion.
284+
285+
## Measuring DOM nodes
286+
287+
See [rules/measuring-dom-nodes.md](rules/measuring-dom-nodes.md) for measuring DOM element dimensions in Remotion.
288+
289+
## Measuring text
290+
291+
See [rules/measuring-text.md](rules/measuring-text.md) for measuring text dimensions, fitting text to containers, and checking overflow.
292+
293+
## Advanced sequencing
294+
295+
See [rules/sequencing.md](rules/sequencing.md) for more sequencing patterns - delay, trim, limit duration of items.
296+
297+
## TailwindCSS
298+
299+
See [rules/tailwind.md](rules/tailwind.md) for using TailwindCSS in Remotion.
300+
301+
## Text animations
302+
303+
See [rules/text-animations.md](rules/text-animations.md) for typography and text animation patterns.
304+
305+
## Advanced timing
306+
307+
See [rules/timing.md](rules/timing.md) for advanced timing with `interpolate` and Bézier easing, and springs.
308+
309+
## Transitions
310+
311+
See [rules/transitions.md](rules/transitions.md) for scene transition patterns.
312+
313+
## Transparent videos
314+
315+
See [rules/transparent-videos.md](rules/transparent-videos.md) for rendering out a video with transparency.
316+
317+
## Trimming
318+
319+
See [rules/trimming.md](rules/trimming.md) for trimming patterns - cutting the beginning or end of animations.
320+
321+
## Advanced Videos
322+
323+
See [rules/videos.md](rules/videos.md) for advanced knowledge about embedding videos - trimming, volume, speed, looping, pitch.
324+
325+
## Parameterized videos
326+
327+
See [rules/parameters.md](rules/parameters.md) for making a composition parametrizable by adding a Zod schema.
328+
329+
## Maps
330+
331+
See [rules/maps.md](rules/maps.md) for adding a map using Mapbox and animating it.
332+
333+
## Voiceover
334+
335+
See [rules/voiceover.md](rules/voiceover.md) for adding AI-generated voiceover to Remotion compositions using ElevenLabs TTS.

skills/remotion/rules/animations.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)