Skip to content

🎥 Make videos programmatically with React

update skills md

Jonny Burger059ea31d7c88
diff --git a/packages/skills/skills/remotion/rules/3d.md b/packages/skills/skills/remotion/rules/3d.md
index 31fa5c6773..c9d254f120 100644
--- a/packages/skills/skills/remotion/rules/3d.md
+++ b/packages/skills/skills/remotion/rules/3d.md
@@ -40,14 +40,14 @@ const { width, height } = useVideoConfig();
<sphereGeometry args={[1, 32, 32]} />
<meshStandardMaterial color="red" />
</mesh>
-</ThreeCanvas>
+</ThreeCanvas>;
```
## No animations not driven by `useCurrentFrame()`
Shaders, models etc MUST NOT animate by themselves.
No animations are allowed unless they are driven by `useCurrentFrame()`.
-Otherwise, it will cause flickering during rendering.
+Otherwise, it will cause flickering during rendering.
Using `useFrame()` from `@react-three/fiber` is forbidden.
@@ -62,7 +62,7 @@ const rotationY = frame * 0.02;
<mesh rotation={[0, rotationY, 0]}>
<boxGeometry args={[2, 2, 2]} />
<meshStandardMaterial color="#4a9eff" />
-</mesh>
+</mesh>;
```
## Using `<Sequence>` inside `<ThreeCanvas>`
@@ -82,5 +82,5 @@ const { width, height } = useVideoConfig();
<meshStandardMaterial color="#4a9eff" />
</mesh>
</Sequence>
-</ThreeCanvas>
-```
\ No newline at end of file
+</ThreeCanvas>;
+```
diff --git a/packages/skills/skills/remotion/rules/animations.md b/packages/skills/skills/remotion/rules/animations.md
index 7e15623f83..619591e8e6 100644
--- a/packages/skills/skills/remotion/rules/animations.md
+++ b/packages/skills/skills/remotion/rules/animations.md
@@ -16,14 +16,12 @@ export const FadeIn = () => {
const { fps } = useVideoConfig();
const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {
- extrapolateRight: 'clamp',
+ extrapolateRight: "clamp",
});
-
- return (
- <div style={{ opacity }}>Hello World!</div>
- );
+
+ 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.
\ No newline at end of file
+Tailwind animation class names are FORBIDDEN - they will not render correctly.
diff --git a/packages/skills/skills/remotion/rules/assets.md b/packages/skills/skills/remotion/rules/assets.md
index 04c8ad590d..a5d40152ef 100644
--- a/packages/skills/skills/remotion/rules/assets.md
+++ b/packages/skills/skills/remotion/rules/assets.md
@@ -16,10 +16,10 @@ Place assets in the `public/` folder at your project root.
You MUST use `staticFile()` to reference files from the `public/` folder:
```tsx
-import {Img, staticFile} from 'remotion';
+import { Img, staticFile } from "remotion";
export const MyComposition = () => {
- return <Img src={staticFile('logo.png')} />;
+ return <Img src={staticFile("logo.png")} />;
};
```
@@ -30,35 +30,35 @@ The function returns an encoded URL that works correctly when deploying to subdi
**Images:**
```tsx
-import {Img, staticFile} from 'remotion';
+import { Img, staticFile } from "remotion";
-<Img src={staticFile('photo.png')} />;
+<Img src={staticFile("photo.png")} />;
```
**Videos:**
```tsx
-import {Video} from '@remotion/media';
-import {staticFile} from 'remotion';
+import { Video } from "@remotion/media";
+import { staticFile } from "remotion";
-<Video src={staticFile('clip.mp4')} />;
+<Video src={staticFile("clip.mp4")} />;
```
**Audio:**
```tsx
-import {Audio} from '@remotion/media';
-import {staticFile} from 'remotion';
+import { Audio } from "@remotion/media";
+import { staticFile } from "remotion";
-<Audio src={staticFile('music.mp3')} />;
+<Audio src={staticFile("music.mp3")} />;
```
**Fonts:**
```tsx
-import {staticFile} from 'remotion';
+import { staticFile } from "remotion";
-const fontFamily = new FontFace('MyFont', `url(${staticFile('font.woff2')})`);
+const fontFamily = new FontFace("MyFont", `url(${staticFile("font.woff2")})`);
await fontFamily.load();
document.fonts.add(fontFamily);
```
diff --git a/packages/skills/skills/remotion/rules/assets/charts-bar-chart.tsx b/packages/skills/skills/remotion/rules/assets/charts-bar-chart.tsx
index 1313ebf598..6c565072fa 100644
--- a/packages/skills/skills/remotion/rules/assets/charts-bar-chart.tsx
+++ b/packages/skills/skills/remotion/rules/assets/charts-bar-chart.tsx
@@ -1,173 +1,178 @@
-import {loadFont} from '@remotion/google-fonts/Inter';
-import {AbsoluteFill, spring, useCurrentFrame, useVideoConfig} from 'remotion';
+import { loadFont } from "@remotion/google-fonts/Inter";
+import {
+ AbsoluteFill,
+ spring,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
-const {fontFamily} = loadFont();
+const { fontFamily } = loadFont();
-const COLOR_BAR = '#D4AF37';
-const COLOR_TEXT = '#ffffff';
-const COLOR_MUTED = '#888888';
-const COLOR_BG = '#0a0a0a';
-const COLOR_AXIS = '#333333';
+const COLOR_BAR = "#D4AF37";
+const COLOR_TEXT = "#ffffff";
+const COLOR_MUTED = "#888888";
+const COLOR_BG = "#0a0a0a";
+const COLOR_AXIS = "#333333";
// Ideal composition size: 1280x720
-const Title: React.FC<{children: React.ReactNode}> = ({children}) => (
- <div style={{textAlign: 'center', marginBottom: 40}}>
- <div style={{color: COLOR_TEXT, fontSize: 48, fontWeight: 600}}>
- {children}
- </div>
- </div>
+const Title: React.FC<{ children: React.ReactNode }> = ({ children }) => (
+ <div style={{ textAlign: "center", marginBottom: 40 }}>
+ <div style={{ color: COLOR_TEXT, fontSize: 48, fontWeight: 600 }}>
+ {children}
+ </div>
+ </div>
);
-const YAxis: React.FC<{steps: number[]; height: number}> = ({
- steps,
- height,
+const YAxis: React.FC<{ steps: number[]; height: number }> = ({
+ steps,
+ height,
}) => (
- <div
- style={{
- display: 'flex',
- flexDirection: 'column',
- justifyContent: 'space-between',
- height,
- paddingRight: 16,
- }}
- >
- {steps
- .slice()
- .reverse()
- .map((step) => (
- <div
- key={step}
- style={{
- color: COLOR_MUTED,
- fontSize: 20,
- textAlign: 'right',
- }}
- >
- {step.toLocaleString()}
- </div>
- ))}
- </div>
+ <div
+ style={{
+ display: "flex",
+ flexDirection: "column",
+ justifyContent: "space-between",
+ height,
+ paddingRight: 16,
+ }}
+ >
+ {steps
+ .slice()
+ .reverse()
+ .map((step) => (
+ <div
+ key={step}
+ style={{
+ color: COLOR_MUTED,
+ fontSize: 20,
+ textAlign: "right",
+ }}
+ >
+ {step.toLocaleString()}
+ </div>
+ ))}
+ </div>
);
const Bar: React.FC<{
- height: number;
- progress: number;
-}> = ({height, progress}) => (
- <div
- style={{
- flex: 1,
- display: 'flex',
- flexDirection: 'column',
- justifyContent: 'flex-end',
- }}
- >
- <div
- style={{
- width: '100%',
- height,
- backgroundColor: COLOR_BAR,
- borderRadius: '8px 8px 0 0',
- opacity: progress,
- }}
- />
- </div>
+ height: number;
+ progress: number;
+}> = ({ height, progress }) => (
+ <div
+ style={{
+ flex: 1,
+ display: "flex",
+ flexDirection: "column",
+ justifyContent: "flex-end",
+ }}
+ >
+ <div
+ style={{
+ width: "100%",
+ height,
+ backgroundColor: COLOR_BAR,
+ borderRadius: "8px 8px 0 0",
+ opacity: progress,
+ }}
+ />
+ </div>
);
const XAxis: React.FC<{
- children: React.ReactNode;
- labels: string[];
- height: number;
-}> = ({children, labels, height}) => (
- <div style={{flex: 1, display: 'flex', flexDirection: 'column'}}>
- <div
- style={{
- display: 'flex',
- alignItems: 'flex-end',
- gap: 16,
- height,
- borderLeft: `2px solid ${COLOR_AXIS}`,
- borderBottom: `2px solid ${COLOR_AXIS}`,
- paddingLeft: 16,
- }}
- >
- {children}
- </div>
- <div
- style={{
- display: 'flex',
- gap: 16,
- paddingLeft: 16,
- marginTop: 12,
- }}
- >
- {labels.map((label) => (
- <div
- key={label}
- style={{
- flex: 1,
- textAlign: 'center',
- color: COLOR_MUTED,
- fontSize: 20,
- }}
- >
- {label}
- </div>
- ))}
- </div>
- </div>
+ children: React.ReactNode;
+ labels: string[];
+ height: number;
+}> = ({ children, labels, height }) => (
+ <div style={{ flex: 1, display: "flex", flexDirection: "column" }}>
+ <div
+ style={{
+ display: "flex",
+ alignItems: "flex-end",
+ gap: 16,
+ height,
+ borderLeft: `2px solid ${COLOR_AXIS}`,
+ borderBottom: `2px solid ${COLOR_AXIS}`,
+ paddingLeft: 16,
+ }}
+ >
+ {children}
+ </div>
+ <div
+ style={{
+ display: "flex",
+ gap: 16,
+ paddingLeft: 16,
+ marginTop: 12,
+ }}
+ >
+ {labels.map((label) => (
+ <div
+ key={label}
+ style={{
+ flex: 1,
+ textAlign: "center",
+ color: COLOR_MUTED,
+ fontSize: 20,
+ }}
+ >
+ {label}
+ </div>
+ ))}
+ </div>
+ </div>
);
export const MyAnimation = () => {
- const frame = useCurrentFrame();
- const {fps, height} = useVideoConfig();
+ const frame = useCurrentFrame();
+ const { fps, height } = useVideoConfig();
- const data = [
- {month: 'Jan', price: 2039},
- {month: 'Mar', price: 2160},
- {month: 'May', price: 2327},
- {month: 'Jul', price: 2426},
- {month: 'Sep', price: 2634},
- {month: 'Nov', price: 2672},
- ];
+ const data = [
+ { month: "Jan", price: 2039 },
+ { month: "Mar", price: 2160 },
+ { month: "May", price: 2327 },
+ { month: "Jul", price: 2426 },
+ { month: "Sep", price: 2634 },
+ { month: "Nov", price: 2672 },
+ ];
- const minPrice = 2000;
- const maxPrice = 2800;
- const priceRange = maxPrice - minPrice;
- const chartHeight = height - 280;
- const yAxisSteps = [2000, 2400, 2800];
+ const minPrice = 2000;
+ const maxPrice = 2800;
+ const priceRange = maxPrice - minPrice;
+ const chartHeight = height - 280;
+ const yAxisSteps = [2000, 2400, 2800];
- return (
- <AbsoluteFill
- style={{
- backgroundColor: COLOR_BG,
- padding: 60,
- display: 'flex',
- flexDirection: 'column',
- fontFamily,
- }}
- >
- <Title>Gold Price 2024</Title>
+ return (
+ <AbsoluteFill
+ style={{
+ backgroundColor: COLOR_BG,
+ padding: 60,
+ display: "flex",
+ flexDirection: "column",
+ fontFamily,
+ }}
+ >
+ <Title>Gold Price 2024</Title>
- <div style={{display: 'flex', flex: 1}}>
- <YAxis steps={yAxisSteps} height={chartHeight} />
- <XAxis height={chartHeight} labels={data.map((d) => d.month)}>
- {data.map((item, i) => {
- const progress = spring({
- frame: frame - i * 5 - 10,
- fps,
- config: {damping: 18, stiffness: 80},
- });
+ <div style={{ display: "flex", flex: 1 }}>
+ <YAxis steps={yAxisSteps} height={chartHeight} />
+ <XAxis height={chartHeight} labels={data.map((d) => d.month)}>
+ {data.map((item, i) => {
+ const progress = spring({
+ frame: frame - i * 5 - 10,
+ fps,
+ config: { damping: 18, stiffness: 80 },
+ });
- const barHeight =
- ((item.price - minPrice) / priceRange) * chartHeight * progress;
+ const barHeight =
+ ((item.price - minPrice) / priceRange) * chartHeight * progress;
- return (
- <Bar key={item.month} height={barHeight} progress={progress} />
- );
- })}
- </XAxis>
- </div>
- </AbsoluteFill>
- );
+ return (
+ <Bar key={item.month} height={barHeight} progress={progress} />
+ );
+ })}
+ </XAxis>
+ </div>
+ </AbsoluteFill>
+ );
};
diff --git a/packages/skills/skills/remotion/rules/assets/text-animations-typewriter.tsx b/packages/skills/skills/remotion/rules/assets/text-animations-typewriter.tsx
index 89f62ea0e5..8ee284a967 100644
--- a/packages/skills/skills/remotion/rules/assets/text-animations-typewriter.tsx
+++ b/packages/skills/skills/remotion/rules/assets/text-animations-typewriter.tsx
@@ -1,14 +1,14 @@
import {
- AbsoluteFill,
- interpolate,
- useCurrentFrame,
- useVideoConfig,
-} from 'remotion';
+ AbsoluteFill,
+ interpolate,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
-const COLOR_BG = '#ffffff';
-const COLOR_TEXT = '#000000';
-const FULL_TEXT = 'From prompt to motion graphics. This is Remotion.';
-const PAUSE_AFTER = 'From prompt to motion graphics.';
+const COLOR_BG = "#ffffff";
+const COLOR_TEXT = "#000000";
+const FULL_TEXT = "From prompt to motion graphics. This is Remotion.";
+const PAUSE_AFTER = "From prompt to motion graphics.";
const FONT_SIZE = 72;
const FONT_WEIGHT = 700;
const CHAR_FRAMES = 2;
@@ -18,83 +18,83 @@ const PAUSE_SECONDS = 1;
// Ideal composition size: 1280x720
const getTypedText = ({
- frame,
- fullText,
- pauseAfter,
- charFrames,
- pauseFrames,
+ frame,
+ fullText,
+ pauseAfter,
+ charFrames,
+ pauseFrames,
}: {
- frame: number;
- fullText: string;
- pauseAfter: string;
- charFrames: number;
- pauseFrames: number;
+ frame: number;
+ fullText: string;
+ pauseAfter: string;
+ charFrames: number;
+ pauseFrames: number;
}): string => {
- const pauseIndex = fullText.indexOf(pauseAfter);
- const preLen =
- pauseIndex >= 0 ? pauseIndex + pauseAfter.length : fullText.length;
+ const pauseIndex = fullText.indexOf(pauseAfter);
+ const preLen =
+ pauseIndex >= 0 ? pauseIndex + pauseAfter.length : fullText.length;
- let typedChars = 0;
- if (frame < preLen * charFrames) {
- typedChars = Math.floor(frame / charFrames);
- } else if (frame < preLen * charFrames + pauseFrames) {
- typedChars = preLen;
- } else {
- const postPhase = frame - preLen * charFrames - pauseFrames;
- typedChars = Math.min(
- fullText.length,
- preLen + Math.floor(postPhase / charFrames),
- );
- }
- return fullText.slice(0, typedChars);
+ let typedChars = 0;
+ if (frame < preLen * charFrames) {
+ typedChars = Math.floor(frame / charFrames);
+ } else if (frame < preLen * charFrames + pauseFrames) {
+ typedChars = preLen;
+ } else {
+ const postPhase = frame - preLen * charFrames - pauseFrames;
+ typedChars = Math.min(
+ fullText.length,
+ preLen + Math.floor(postPhase / charFrames),
+ );
+ }
+ return fullText.slice(0, typedChars);
};
const Cursor: React.FC<{
- frame: number;
- blinkFrames: number;
- symbol?: string;
-}> = ({frame, blinkFrames, symbol = '\u258C'}) => {
- const opacity = interpolate(
- frame % blinkFrames,
- [0, blinkFrames / 2, blinkFrames],
- [1, 0, 1],
- {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},
- );
+ frame: number;
+ blinkFrames: number;
+ symbol?: string;
+}> = ({ frame, blinkFrames, symbol = "\u258C" }) => {
+ const opacity = interpolate(
+ frame % blinkFrames,
+ [0, blinkFrames / 2, blinkFrames],
+ [1, 0, 1],
+ { extrapolateLeft: "clamp", extrapolateRight: "clamp" },
+ );
- return <span style={{opacity}}>{symbol}</span>;
+ return <span style={{ opacity }}>{symbol}</span>;
};
export const MyAnimation = () => {
- const frame = useCurrentFrame();
- const {fps} = useVideoConfig();
+ const frame = useCurrentFrame();
+ const { fps } = useVideoConfig();
- const pauseFrames = Math.round(fps * PAUSE_SECONDS);
+ const pauseFrames = Math.round(fps * PAUSE_SECONDS);
- const typedText = getTypedText({
- frame,
- fullText: FULL_TEXT,
- pauseAfter: PAUSE_AFTER,
- charFrames: CHAR_FRAMES,
- pauseFrames,
- });
+ const typedText = getTypedText({
+ frame,
+ fullText: FULL_TEXT,
+ pauseAfter: PAUSE_AFTER,
+ charFrames: CHAR_FRAMES,
+ pauseFrames,
+ });
- return (
- <AbsoluteFill
- style={{
- backgroundColor: COLOR_BG,
- }}
- >
- <div
- style={{
- color: COLOR_TEXT,
- fontSize: FONT_SIZE,
- fontWeight: FONT_WEIGHT,
- fontFamily: 'sans-serif',
- }}
- >
- <span>{typedText}</span>
- <Cursor frame={frame} blinkFrames={CURSOR_BLINK_FRAMES} />
- </div>
- </AbsoluteFill>
- );
+ return (
+ <AbsoluteFill
+ style={{
+ backgroundColor: COLOR_BG,
+ }}
+ >
+ <div
+ style={{
+ color: COLOR_TEXT,
+ fontSize: FONT_SIZE,
+ fontWeight: FONT_WEIGHT,
+ fontFamily: "sans-serif",
+ }}
+ >
+ <span>{typedText}</span>
+ <Cursor frame={frame} blinkFrames={CURSOR_BLINK_FRAMES} />
+ </div>
+ </AbsoluteFill>
+ );
};
diff --git a/packages/skills/skills/remotion/rules/assets/text-animations-word-highlight.tsx b/packages/skills/skills/remotion/rules/assets/text-animations-word-highlight.tsx
index e3929c58a1..4da09ceed7 100644
--- a/packages/skills/skills/remotion/rules/assets/text-animations-word-highlight.tsx
+++ b/packages/skills/skills/remotion/rules/assets/text-animations-word-highlight.tsx
@@ -1,11 +1,11 @@
-import {loadFont} from '@remotion/google-fonts/Inter';
-import React from 'react';
+import { loadFont } from "@remotion/google-fonts/Inter";
+import React from "react";
import {
- AbsoluteFill,
- spring,
- useCurrentFrame,
- useVideoConfig,
-} from 'remotion';
+ AbsoluteFill,
+ spring,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
/*
* Highlight a word in a sentence with a spring-animated wipe effect.
@@ -13,96 +13,96 @@ import {
// Ideal composition size: 1280x720
-const COLOR_BG = '#ffffff';
-const COLOR_TEXT = '#000000';
-const COLOR_HIGHLIGHT = '#A7C7E7';
-const FULL_TEXT = 'This is Remotion.';
-const HIGHLIGHT_WORD = 'Remotion';
+const COLOR_BG = "#ffffff";
+const COLOR_TEXT = "#000000";
+const COLOR_HIGHLIGHT = "#A7C7E7";
+const FULL_TEXT = "This is Remotion.";
+const HIGHLIGHT_WORD = "Remotion";
const FONT_SIZE = 72;
const FONT_WEIGHT = 700;
const HIGHLIGHT_START_FRAME = 30;
const HIGHLIGHT_WIPE_DURATION = 18;
-const {fontFamily} = loadFont();
+const { fontFamily } = loadFont();
const Highlight: React.FC<{
- word: string;
- color: string;
- delay: number;
- durationInFrames: number;
-}> = ({word, color, delay, durationInFrames}) => {
- const frame = useCurrentFrame();
- const {fps} = useVideoConfig();
+ word: string;
+ color: string;
+ delay: number;
+ durationInFrames: number;
+}> = ({ word, color, delay, durationInFrames }) => {
+ const frame = useCurrentFrame();
+ const { fps } = useVideoConfig();
- const highlightProgress = spring({
- fps,
- frame,
- config: {damping: 200},
- delay,
- durationInFrames,
- });
- const scaleX = Math.max(0, Math.min(1, highlightProgress));
+ const highlightProgress = spring({
+ fps,
+ frame,
+ config: { damping: 200 },
+ delay,
+ durationInFrames,
+ });
+ const scaleX = Math.max(0, Math.min(1, highlightProgress));
- return (
- <span style={{position: 'relative', display: 'inline-block'}}>
- <span
- style={{
- position: 'absolute',
- left: 0,
- right: 0,
- top: '50%',
- height: '1.05em',
- transform: `translateY(-50%) scaleX(${scaleX})`,
- transformOrigin: 'left center',
- backgroundColor: color,
- borderRadius: '0.18em',
- zIndex: 0,
- }}
- />
- <span style={{position: 'relative', zIndex: 1}}>{word}</span>
- </span>
- );
+ return (
+ <span style={{ position: "relative", display: "inline-block" }}>
+ <span
+ style={{
+ position: "absolute",
+ left: 0,
+ right: 0,
+ top: "50%",
+ height: "1.05em",
+ transform: `translateY(-50%) scaleX(${scaleX})`,
+ transformOrigin: "left center",
+ backgroundColor: color,
+ borderRadius: "0.18em",
+ zIndex: 0,
+ }}
+ />
+ <span style={{ position: "relative", zIndex: 1 }}>{word}</span>
+ </span>
+ );
};
export const MyAnimation = () => {
- const highlightIndex = FULL_TEXT.indexOf(HIGHLIGHT_WORD);
- const hasHighlight = highlightIndex >= 0;
- const preText = hasHighlight ? FULL_TEXT.slice(0, highlightIndex) : FULL_TEXT;
- const postText = hasHighlight
- ? FULL_TEXT.slice(highlightIndex + HIGHLIGHT_WORD.length)
- : '';
+ const highlightIndex = FULL_TEXT.indexOf(HIGHLIGHT_WORD);
+ const hasHighlight = highlightIndex >= 0;
+ const preText = hasHighlight ? FULL_TEXT.slice(0, highlightIndex) : FULL_TEXT;
+ const postText = hasHighlight
+ ? FULL_TEXT.slice(highlightIndex + HIGHLIGHT_WORD.length)
+ : "";
- return (
- <AbsoluteFill
- style={{
- backgroundColor: COLOR_BG,
- alignItems: 'center',
- justifyContent: 'center',
- fontFamily,
- }}
- >
- <div
- style={{
- color: COLOR_TEXT,
- fontSize: FONT_SIZE,
- fontWeight: FONT_WEIGHT,
- }}
- >
- {hasHighlight ? (
- <>
- <span>{preText}</span>
- <Highlight
- word={HIGHLIGHT_WORD}
- color={COLOR_HIGHLIGHT}
- delay={HIGHLIGHT_START_FRAME}
- durationInFrames={HIGHLIGHT_WIPE_DURATION}
- />
- <span>{postText}</span>
- </>
- ) : (
- <span>{FULL_TEXT}</span>
- )}
- </div>
- </AbsoluteFill>
- );
+ return (
+ <AbsoluteFill
+ style={{
+ backgroundColor: COLOR_BG,
+ alignItems: "center",
+ justifyContent: "center",
+ fontFamily,
+ }}
+ >
+ <div
+ style={{
+ color: COLOR_TEXT,
+ fontSize: FONT_SIZE,
+ fontWeight: FONT_WEIGHT,
+ }}
+ >
+ {hasHighlight ? (
+ <>
+ <span>{preText}</span>
+ <Highlight
+ word={HIGHLIGHT_WORD}
+ color={COLOR_HIGHLIGHT}
+ delay={HIGHLIGHT_START_FRAME}
+ durationInFrames={HIGHLIGHT_WIPE_DURATION}
+ />
+ <span>{postText}</span>
+ </>
+ ) : (
+ <span>{FULL_TEXT}</span>
+ )}
+ </div>
+ </AbsoluteFill>
+ );
};
diff --git a/packages/skills/skills/remotion/rules/compositions.md b/packages/skills/skills/remotion/rules/compositions.md
index 129eadaedb..0db5f60266 100644
--- a/packages/skills/skills/remotion/rules/compositions.md
+++ b/packages/skills/skills/remotion/rules/compositions.md
@@ -10,11 +10,20 @@ A `<Composition>` defines the component, width, height, fps and duration of a re
It normally is placed in the `src/Root.tsx` file.
```tsx
-import {Composition} from 'remotion';
-import {MyComposition} from './MyComposition';
+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} />;
+ return (
+ <Composition
+ id="MyComposition"
+ component={MyComposition}
+ durationInFrames={100}
+ fps={30}
+ width={1080}
+ height={1080}
+ />
+ );
};
```
@@ -24,8 +33,8 @@ 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';
+import { Composition } from "remotion";
+import { MyComposition, MyCompositionProps } from "./MyComposition";
export const RemotionRoot = () => {
return (
@@ -38,8 +47,8 @@ export const RemotionRoot = () => {
height={1080}
defaultProps={
{
- title: 'Hello World',
- color: '#ff0000',
+ title: "Hello World",
+ color: "#ff0000",
} satisfies MyCompositionProps
}
/>
@@ -55,7 +64,7 @@ Use `<Folder>` to organize compositions in the sidebar.
Folder names can only contain letters, numbers, and hyphens.
```tsx
-import {Composition, Folder} from 'remotion';
+import { Composition, Folder } from "remotion";
export const RemotionRoot = () => {
return (
@@ -80,11 +89,13 @@ export const RemotionRoot = () => {
Use `<Still>` for single-frame images. It does not require `durationInFrames` or `fps`.
```tsx
-import {Still} from 'remotion';
-import {Thumbnail} from './Thumbnail';
+import { Still } from "remotion";
+import { Thumbnail } from "./Thumbnail";
export const RemotionRoot = () => {
- return <Still id="Thumbnail" component={Thumbnail} width={1280} height={720} />;
+ return (
+ <Still id="Thumbnail" component={Thumbnail} width={1280} height={720} />
+ );
};
```
@@ -93,10 +104,12 @@ export const RemotionRoot = () => {
Use `calculateMetadata` to make dimensions, duration, or props dynamic based on data.
```tsx
-import {Composition, CalculateMetadataFunction} from 'remotion';
-import {MyComposition, MyCompositionProps} from './MyComposition';
+import { Composition, CalculateMetadataFunction } from "remotion";
+import { MyComposition, MyCompositionProps } from "./MyComposition";
-const calculateMetadata: CalculateMetadataFunction<MyCompositionProps> = async ({props, abortSignal}) => {
+const calculateMetadata: CalculateMetadataFunction<
+ MyCompositionProps
+> = async ({ props, abortSignal }) => {
const data = await fetch(`https://api.example.com/video/${props.videoId}`, {
signal: abortSignal,
}).then((res) => res.json());
@@ -119,7 +132,7 @@ export const RemotionRoot = () => {
fps={30}
width={1080}
height={1080}
- defaultProps={{videoId: 'abc123'}}
+ defaultProps={{ videoId: "abc123" }}
calculateMetadata={calculateMetadata}
/>
);
diff --git a/packages/skills/skills/remotion/rules/extract-frames.md b/packages/skills/skills/remotion/rules/extract-frames.md
index 46e63efc58..1a8a0c8935 100644
--- a/packages/skills/skills/remotion/rules/extract-frames.md
+++ b/packages/skills/skills/remotion/rules/extract-frames.md
@@ -29,7 +29,7 @@ type Options = {
};
export type ExtractFramesTimestampsInSecondsFn = (
- options: Options
+ options: Options,
) => Promise<number[]> | number[];
export type ExtractFramesProps = {
@@ -133,14 +133,14 @@ await extractFrames({
timestampsInSeconds: async ({ track, durationInSeconds }) => {
const aspectRatio = track.width / track.height;
const amountOfFramesFit = Math.ceil(
- canvasWidth / (canvasHeight * aspectRatio)
+ canvasWidth / (canvasHeight * aspectRatio),
);
const segmentDuration = toSeconds - fromSeconds;
const timestamps: number[] = [];
for (let i = 0; i < amountOfFramesFit; i++) {
timestamps.push(
- fromSeconds + (segmentDuration / amountOfFramesFit) * (i + 0.5)
+ fromSeconds + (segmentDuration / amountOfFramesFit) * (i + 0.5),
);
}
diff --git a/packages/skills/skills/remotion/rules/get-video-dimensions.md b/packages/skills/skills/remotion/rules/get-video-dimensions.md
index b1b212a088..746c09fbec 100644
--- a/packages/skills/skills/remotion/rules/get-video-dimensions.md
+++ b/packages/skills/skills/remotion/rules/get-video-dimensions.md
@@ -38,7 +38,7 @@ export const getVideoDimensions = async (src: string) => {
```tsx
const dimensions = await getVideoDimensions("https://remotion.media/video.mp4");
-console.log(dimensions.width); // e.g. 1920
+console.log(dimensions.width); // e.g. 1920
console.log(dimensions.height); // e.g. 1080
```
diff --git a/packages/skills/skills/remotion/rules/images.md b/packages/skills/skills/remotion/rules/images.md
index 262bb57bfb..3b0319442f 100644
--- a/packages/skills/skills/remotion/rules/images.md
+++ b/packages/skills/skills/remotion/rules/images.md
@@ -46,7 +46,7 @@ my-video/
```tsx
import { Img, staticFile } from "remotion";
-<Img src={staticFile("logo.png")} />
+<Img src={staticFile("logo.png")} />;
```
## Remote images
@@ -118,7 +118,11 @@ 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";
+import {
+ getImageDimensions,
+ staticFile,
+ CalculateMetadataFunction,
+} from "remotion";
const calculateMetadata: CalculateMetadataFunction = async () => {
const { width, height } = await getImageDimensions(staticFile("photo.png"));
diff --git a/packages/skills/skills/remotion/rules/lottie.md b/packages/skills/skills/remotion/rules/lottie.md
index 4d07acded4..4b0c4ee515 100644
--- a/packages/skills/skills/remotion/rules/lottie.md
+++ b/packages/skills/skills/remotion/rules/lottie.md
@@ -29,17 +29,18 @@ To import a Lottie animation:
- Render the Lottie animation using the `Lottie` component from the `@remotion/lottie` package
```tsx
-import {Lottie, LottieAnimationData} from '@remotion/lottie';
-import {useEffect, useState} from 'react';
-import {cancelRender, continueRender, delayRender} from 'remotion';
+import { Lottie, LottieAnimationData } from "@remotion/lottie";
+import { useEffect, useState } from "react";
+import { cancelRender, continueRender, delayRender } from "remotion";
export const MyAnimation = () => {
- const [handle] = useState(() => delayRender('Loading Lottie animation'));
+ const [handle] = useState(() => delayRender("Loading Lottie animation"));
- const [animationData, setAnimationData] = useState<LottieAnimationData | null>(null);
+ const [animationData, setAnimationData] =
+ useState<LottieAnimationData | null>(null);
useEffect(() => {
- fetch('https://assets4.lottiefiles.com/packages/lf20_zyquagfl.json')
+ fetch("https://assets4.lottiefiles.com/packages/lf20_zyquagfl.json")
.then((data) => data.json())
.then((json) => {
setAnimationData(json);
@@ -63,6 +64,7 @@ export const MyAnimation = () => {
Lottie supports the `style` prop to allow styles and animations:
```tsx
-return <Lottie animationData={animationData} style={{width: 400, height: 400}} />;
+return (
+ <Lottie animationData={animationData} style={{ width: 400, height: 400 }} />
+);
```
-
diff --git a/packages/skills/skills/remotion/rules/maps.md b/packages/skills/skills/remotion/rules/maps.md
index 0ef016258e..1e4818cc5b 100644
--- a/packages/skills/skills/remotion/rules/maps.md
+++ b/packages/skills/skills/remotion/rules/maps.md
@@ -51,9 +51,9 @@ REMOTION_MAPBOX_TOKEN==pk.your-mapbox-access-token
Here is a basic example of a map in Remotion.
```tsx
-import {useEffect, useMemo, useRef, useState} from 'react';
-import {AbsoluteFill, useDelayRender, useVideoConfig} from 'remotion';
-import mapboxgl, {Map} from 'mapbox-gl';
+import { useEffect, useMemo, useRef, useState } from "react";
+import { AbsoluteFill, useDelayRender, useVideoConfig } from "remotion";
+import mapboxgl, { Map } from "mapbox-gl";
export const lineCoordinates = [
[6.56158447265625, 46.059891147620725],
@@ -69,10 +69,10 @@ mapboxgl.accessToken = process.env.REMOTION_MAPBOX_TOKEN as string;
export const MyComposition = () => {
const ref = useRef<HTMLDivElement>(null);
- const {delayRender, continueRender} = useDelayRender();
+ const { delayRender, continueRender } = useDelayRender();
- const {width, height} = useVideoConfig();
- const [handle] = useState(() => delayRender('Loading map...'));
+ const { width, height } = useVideoConfig();
+ const [handle] = useState(() => delayRender("Loading map..."));
const [map, setMap] = useState<Map | null>(null);
useEffect(() => {
@@ -82,71 +82,74 @@ export const MyComposition = () => {
center: [6.5615, 46.0598],
pitch: 65,
bearing: 0,
- style: '⁠mapbox://styles/mapbox/standard',
+ style: "⁠mapbox://styles/mapbox/standard",
interactive: false,
fadeDuration: 0,
});
- _map.on('style.load', () => {
+ _map.on("style.load", () => {
// Hide all features from the Mapbox Standard style
const hideFeatures = [
- 'showRoadsAndTransit',
- 'showRoads',
- 'showTransit',
- 'showPedestrianRoads',
- 'showRoadLabels',
- 'showTransitLabels',
- 'showPlaceLabels',
- 'showPointOfInterestLabels',
- 'showPointsOfInterest',
- 'showAdminBoundaries',
- 'showLandmarkIcons',
- 'showLandmarkIconLabels',
- 'show3dObjects',
- 'show3dBuildings',
- 'show3dTrees',
- 'show3dLandmarks',
- 'show3dFacades',
+ "showRoadsAndTransit",
+ "showRoads",
+ "showTransit",
+ "showPedestrianRoads",
+ "showRoadLabels",
+ "showTransitLabels",
+ "showPlaceLabels",
+ "showPointOfInterestLabels",
+ "showPointsOfInterest",
+ "showAdminBoundaries",
+ "showLandmarkIcons",
+ "showLandmarkIconLabels",
+ "show3dObjects",
+ "show3dBuildings",
+ "show3dTrees",
+ "show3dLandmarks",
+ "show3dFacades",
];
for (const feature of hideFeatures) {
- _map.setConfigProperty('basemap', feature, false);
+ _map.setConfigProperty("basemap", feature, false);
}
- _map.setConfigProperty('basemap', 'colorTrunks', 'rgba(0, 0, 0, 0)');
+ _map.setConfigProperty("basemap", "colorTrunks", "rgba(0, 0, 0, 0)");
- _map.addSource('trace', {
- type: 'geojson',
+ _map.addSource("trace", {
+ type: "geojson",
data: {
- type: 'Feature',
+ type: "Feature",
properties: {},
geometry: {
- type: 'LineString',
+ type: "LineString",
coordinates: lineCoordinates,
},
},
});
_map.addLayer({
- type: 'line',
- source: 'trace',
- id: 'line',
+ type: "line",
+ source: "trace",
+ id: "line",
paint: {
- 'line-color': 'black',
- 'line-width': 5,
+ "line-color": "black",
+ "line-width": 5,
},
layout: {
- 'line-cap': 'round',
- 'line-join': 'round',
+ "line-cap": "round",
+ "line-join": "round",
},
});
});
- _map.on('load', () => {
+ _map.on("load", () => {
continueRender(handle);
setMap(_map);
});
}, [handle, lineCoordinates]);
- const style: React.CSSProperties = useMemo(() => ({width, height, position: 'absolute'}), [width, height]);
+ const style: React.CSSProperties = useMemo(
+ () => ({ width, height, position: "absolute" }),
+ [width, height],
+ );
return <AbsoluteFill ref={ref} style={style} />;
};
@@ -174,31 +177,31 @@ Unless I request otherwise, remove all features from the Mapbox Standard style.
```tsx
// Hide all features from the Mapbox Standard style
const hideFeatures = [
- 'showRoadsAndTransit',
- 'showRoads',
- 'showTransit',
- 'showPedestrianRoads',
- 'showRoadLabels',
- 'showTransitLabels',
- 'showPlaceLabels',
- 'showPointOfInterestLabels',
- 'showPointsOfInterest',
- 'showAdminBoundaries',
- 'showLandmarkIcons',
- 'showLandmarkIconLabels',
- 'show3dObjects',
- 'show3dBuildings',
- 'show3dTrees',
- 'show3dLandmarks',
- 'show3dFacades',
+ "showRoadsAndTransit",
+ "showRoads",
+ "showTransit",
+ "showPedestrianRoads",
+ "showRoadLabels",
+ "showTransitLabels",
+ "showPlaceLabels",
+ "showPointOfInterestLabels",
+ "showPointsOfInterest",
+ "showAdminBoundaries",
+ "showLandmarkIcons",
+ "showLandmarkIconLabels",
+ "show3dObjects",
+ "show3dBuildings",
+ "show3dTrees",
+ "show3dLandmarks",
+ "show3dFacades",
];
for (const feature of hideFeatures) {
- _map.setConfigProperty('basemap', feature, false);
+ _map.setConfigProperty("basemap", feature, false);
}
-_map.setConfigProperty('basemap', 'colorMotorways', 'transparent');
-_map.setConfigProperty('basemap', 'colorRoads', 'transparent');
-_map.setConfigProperty('basemap', 'colorTrunks', 'transparent');
+_map.setConfigProperty("basemap", "colorMotorways", "transparent");
+_map.setConfigProperty("basemap", "colorRoads", "transparent");
+_map.setConfigProperty("basemap", "colorTrunks", "transparent");
```
## Animating the camera
@@ -208,10 +211,10 @@ You can animate the camera along the line by adding a `useEffect` hook that upda
Unless I ask for it, do not jump between camera angles.
```tsx
-import * as turf from '@turf/turf';
-import {interpolate} from 'remotion';
-import {Easing} from 'remotion';
-import {useCurrentFrame, useVideoConfig, useDelayRender} from 'remotion';
+import * as turf from "@turf/turf";
+import { interpolate } from "remotion";
+import { Easing } from "remotion";
+import { useCurrentFrame, useVideoConfig, useDelayRender } from "remotion";
const animationDuration = 20;
const cameraAltitude = 4000;
@@ -219,26 +222,34 @@ const cameraAltitude = 4000;
```tsx
const frame = useCurrentFrame();
-const {fps} = useVideoConfig();
-const {delayRender, continueRender} = useDelayRender();
+const { fps } = useVideoConfig();
+const { delayRender, continueRender } = useDelayRender();
useEffect(() => {
if (!map) {
return;
}
- const handle = delayRender('Moving point...');
+ const handle = delayRender("Moving point...");
const routeDistance = turf.length(turf.lineString(lineCoordinates));
- const progress = interpolate(frame / fps, [0.00001, animationDuration], [0, 1], {
- easing: Easing.inOut(Easing.sin),
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- });
+ const progress = interpolate(
+ frame / fps,
+ [0.00001, animationDuration],
+ [0, 1],
+ {
+ easing: Easing.inOut(Easing.sin),
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ },
+ );
const camera = map.getFreeCameraOptions();
- const alongRoute = turf.along(turf.lineString(lineCoordinates), routeDistance * progress).geometry.coordinates;
+ const alongRoute = turf.along(
+ turf.lineString(lineCoordinates),
+ routeDistance * progress,
+ ).geometry.coordinates;
camera.lookAtPoint({
lng: alongRoute[0],
@@ -246,7 +257,7 @@ useEffect(() => {
});
map.setFreeCameraOptions(camera);
- map.once('idle', () => continueRender(handle));
+ map.once("idle", () => continueRender(handle));
}, [lineCoordinates, fps, frame, handle, map]);
```
@@ -267,16 +278,16 @@ To animate a line that appears straight on the map, use linear interpolation bet
```tsx
const frame = useCurrentFrame();
-const {durationInFrames} = useVideoConfig();
+const { durationInFrames } = useVideoConfig();
useEffect(() => {
if (!map) return;
- const animationHandle = delayRender('Animating line...');
+ const animationHandle = delayRender("Animating line...");
const progress = interpolate(frame, [0, durationInFrames - 1], [0, 1], {
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
easing: Easing.inOut(Easing.cubic),
});
@@ -287,20 +298,20 @@ useEffect(() => {
const currentLat = start[1] + (end[1] - start[1]) * progress;
const lineData: GeoJSON.Feature<GeoJSON.LineString> = {
- type: 'Feature',
+ type: "Feature",
properties: {},
geometry: {
- type: 'LineString',
+ type: "LineString",
coordinates: [start, [currentLng, currentLat]],
},
};
- const source = map.getSource('trace') as mapboxgl.GeoJSONSource;
+ const source = map.getSource("trace") as mapboxgl.GeoJSONSource;
if (source) {
source.setData(lineData);
}
- map.once('idle', () => continueRender(animationHandle));
+ map.once("idle", () => continueRender(animationHandle));
}, [frame, map, durationInFrames]);
```
@@ -309,7 +320,7 @@ useEffect(() => {
To animate a line that follows the geodesic (great circle) path between two points, use turf's `lineSliceAlong`. This is useful for showing flight paths or the actual shortest distance on Earth.
```tsx
-import * as turf from '@turf/turf';
+import * as turf from "@turf/turf";
const routeLine = turf.lineString(lineCoordinates);
const routeDistance = turf.length(routeLine);
@@ -317,7 +328,7 @@ const routeDistance = turf.length(routeLine);
const currentDistance = Math.max(0.001, routeDistance * progress);
const slicedLine = turf.lineSliceAlong(routeLine, 0, currentDistance);
-const source = map.getSource('route') as mapboxgl.GeoJSONSource;
+const source = map.getSource("route") as mapboxgl.GeoJSONSource;
if (source) {
source.setData(slicedLine);
}
@@ -328,47 +339,47 @@ if (source) {
Add labels, and markers where appropriate.
```tsx
-_map.addSource('markers', {
- type: 'geojson',
+_map.addSource("markers", {
+ type: "geojson",
data: {
- type: 'FeatureCollection',
+ type: "FeatureCollection",
features: [
{
- type: 'Feature',
- properties: {name: 'Point 1'},
- geometry: {type: 'Point', coordinates: [-118.2437, 34.0522]},
+ type: "Feature",
+ properties: { name: "Point 1" },
+ geometry: { type: "Point", coordinates: [-118.2437, 34.0522] },
},
],
},
});
_map.addLayer({
- id: 'city-markers',
- type: 'circle',
- source: 'markers',
+ id: "city-markers",
+ type: "circle",
+ source: "markers",
paint: {
- 'circle-radius': 40,
- 'circle-color': '#FF4444',
- 'circle-stroke-width': 4,
- 'circle-stroke-color': '#FFFFFF',
+ "circle-radius": 40,
+ "circle-color": "#FF4444",
+ "circle-stroke-width": 4,
+ "circle-stroke-color": "#FFFFFF",
},
});
_map.addLayer({
- id: 'labels',
- type: 'symbol',
- source: 'markers',
+ id: "labels",
+ type: "symbol",
+ source: "markers",
layout: {
- 'text-field': ['get', 'name'],
- 'text-font': ['DIN Pro Bold', 'Arial Unicode MS Bold'],
- 'text-size': 50,
- 'text-offset': [0, 0.5],
- 'text-anchor': 'top',
+ "text-field": ["get", "name"],
+ "text-font": ["DIN Pro Bold", "Arial Unicode MS Bold"],
+ "text-size": 50,
+ "text-offset": [0, 0.5],
+ "text-anchor": "top",
},
paint: {
- 'text-color': '#FFFFFF',
- 'text-halo-color': '#000000',
- 'text-halo-width': 2,
+ "text-color": "#FFFFFF",
+ "text-halo-color": "#000000",
+ "text-halo-width": 2,
},
});
```
@@ -387,9 +398,9 @@ IMPORTANT: Keep the `text-offset` small enough so it is close to the marker. Con
To enable 3D buildings, use the following code:
```tsx
-_map.setConfigProperty('basemap', 'show3dObjects', true);
-_map.setConfigProperty('basemap', 'show3dLandmarks', true);
-_map.setConfigProperty('basemap', 'show3dBuildings', true);
+_map.setConfigProperty("basemap", "show3dObjects", true);
+_map.setConfigProperty("basemap", "show3dLandmarks", true);
+_map.setConfigProperty("basemap", "show3dBuildings", true);
```
## Rendering
diff --git a/packages/skills/skills/remotion/rules/measuring-dom-nodes.md b/packages/skills/skills/remotion/rules/measuring-dom-nodes.md
index 1f9d2bfa0a..4e63424f3a 100644
--- a/packages/skills/skills/remotion/rules/measuring-dom-nodes.md
+++ b/packages/skills/skills/remotion/rules/measuring-dom-nodes.md
@@ -32,4 +32,3 @@ export const MyComponent = () => {
return <div ref={ref}>Content to measure</div>;
};
```
-
diff --git a/packages/skills/skills/remotion/rules/parameters.md b/packages/skills/skills/remotion/rules/parameters.md
index 6ee45788a0..cffd64c3d6 100644
--- a/packages/skills/skills/remotion/rules/parameters.md
+++ b/packages/skills/skills/remotion/rules/parameters.md
@@ -38,7 +38,7 @@ pnpm i [email protected]
Then, a Zod schema can be defined alongside the component:
```tsx title="src/MyComposition.tsx"
-import {z} from 'zod';
+import { z } from "zod";
export const MyCompositionSchema = z.object({
title: z.string(),
@@ -56,11 +56,22 @@ const MyComponent: React.FC<z.infer<typeof MyCompositionSchema>> = () => {
In the root file, the schema can be passed to the composition:
```tsx title="src/Root.tsx"
-import {Composition} from 'remotion';
-import {MycComponent, MyCompositionSchema} from './MyComposition';
+import { Composition } from "remotion";
+import { MycComponent, MyCompositionSchema } from "./MyComposition";
export const RemotionRoot = () => {
- return <Composition id="MyComposition" component={MyComponent} durationInFrames={100} fps={30} width={1080} height={1080} defaultProps={{title: 'Hello World'}} schema={MyCompositionSchema} />;
+ return (
+ <Composition
+ id="MyComposition"
+ component={MyComponent}
+ durationInFrames={100}
+ fps={30}
+ width={1080}
+ height={1080}
+ defaultProps={{ title: "Hello World" }}
+ schema={MyCompositionSchema}
+ />
+ );
};
```
@@ -86,7 +97,7 @@ pnpm exec remotion add @remotion/zod-types # If project uses pnpm
Then import `zColor` from `@remotion/zod-types`:
```tsx
-import {zColor} from '@remotion/zod-types';
+import { zColor } from "@remotion/zod-types";
```
Then use it in the schema:
diff --git a/packages/skills/skills/remotion/rules/sequencing.md b/packages/skills/skills/remotion/rules/sequencing.md
index c54a750e7f..46b86a8872 100644
--- a/packages/skills/skills/remotion/rules/sequencing.md
+++ b/packages/skills/skills/remotion/rules/sequencing.md
@@ -45,7 +45,7 @@ Always premount any `<Sequence>`!
Use `<Series>` when elements should play one after another without overlap.
```tsx
-import {Series} from 'remotion';
+import { Series } from "remotion";
<Series>
<Series.Sequence durationInFrames={45}>
diff --git a/packages/skills/skills/remotion/rules/tailwind.md b/packages/skills/skills/remotion/rules/tailwind.md
index d2f51952e1..928f63312a 100644
--- a/packages/skills/skills/remotion/rules/tailwind.md
+++ b/packages/skills/skills/remotion/rules/tailwind.md
@@ -6,6 +6,6 @@ metadata:
You can and should use TailwindCSS in Remotion, if TailwindCSS is installed in the project.
-Don't use `transition-*` or `animate-*` classes - always animate using the `useCurrentFrame()` hook.
+Don't use `transition-*` or `animate-*` classes - always animate using the `useCurrentFrame()` hook.
-Tailwind must be installed and enabled first in a Remotion project - fetch https://www.remotion.dev/docs/tailwind using WebFetch for instructions.
\ No newline at end of file
+Tailwind must be installed and enabled first in a Remotion project - fetch https://www.remotion.dev/docs/tailwind using WebFetch for instructions.
diff --git a/packages/skills/skills/remotion/rules/timing.md b/packages/skills/skills/remotion/rules/timing.md
index 464d4e29cd..a7b49876b6 100644
--- a/packages/skills/skills/remotion/rules/timing.md
+++ b/packages/skills/skills/remotion/rules/timing.md
@@ -8,7 +8,7 @@ metadata:
A simple linear interpolation is done using the `interpolate` function.
```ts title="Going from 0 to 1 over 100 frames"
-import {interpolate} from 'remotion';
+import { interpolate } from "remotion";
const opacity = interpolate(frame, [0, 100], [0, 1]);
```
@@ -18,8 +18,8 @@ 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',
+ extrapolateRight: "clamp",
+ extrapolateLeft: "clamp",
});
```
@@ -29,10 +29,10 @@ Spring animations have a more natural motion.
They go from 0 to 1 over time.
```ts title="Spring animation from 0 to 1 over 100 frames"
-import {spring, useCurrentFrame, useVideoConfig} from 'remotion';
+import { spring, useCurrentFrame, useVideoConfig } from "remotion";
const frame = useCurrentFrame();
-const {fps} = useVideoConfig();
+const { fps } = useVideoConfig();
const scale = spring({
frame,
@@ -51,7 +51,7 @@ The config can be overwritten like this:
const scale = spring({
frame,
fps,
- config: {damping: 200},
+ config: { damping: 200 },
});
```
@@ -60,10 +60,10 @@ The recommended configuration for a natural motion without a bounce is: `{ dampi
Here are some common configurations:
```tsx
-const smooth = {damping: 200}; // Smooth, no bounce (subtle reveals)
-const snappy = {damping: 20, stiffness: 200}; // Snappy, minimal bounce (UI elements)
-const bouncy = {damping: 8}; // Bouncy entrance (playful animations)
-const heavy = {damping: 15, stiffness: 80, mass: 2}; // Heavy, slow, small bounce
+const smooth = { damping: 200 }; // Smooth, no bounce (subtle reveals)
+const snappy = { damping: 20, stiffness: 200 }; // Snappy, minimal bounce (UI elements)
+const bouncy = { damping: 8 }; // Bouncy entrance (playful animations)
+const heavy = { damping: 15, stiffness: 80, mass: 2 }; // Heavy, slow, small bounce
```
### Delay
@@ -105,7 +105,7 @@ const springProgress = spring({
// Map to rotation
const rotation = interpolate(springProgress, [0, 1], [0, 360]);
-<div style={{rotate: rotation + 'deg'}} />;
+<div style={{ rotate: rotation + "deg" }} />;
```
### Adding springs
@@ -114,7 +114,7 @@ Springs return just numbers, so math can be performed:
```tsx
const frame = useCurrentFrame();
-const {fps, durationInFrames} = useVideoConfig();
+const { fps, durationInFrames } = useVideoConfig();
const inAnimation = spring({
frame,
@@ -135,12 +135,12 @@ const scale = inAnimation - outAnimation;
Easing can be added to the `interpolate` function:
```ts
-import {interpolate, Easing} from 'remotion';
+import { interpolate, Easing } from "remotion";
const value1 = interpolate(frame, [0, 100], [0, 1], {
easing: Easing.inOut(Easing.quad),
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
});
```
@@ -163,8 +163,8 @@ Convexities and curves need be combined for an easing function:
```ts
const value1 = interpolate(frame, [0, 100], [0, 1], {
easing: Easing.inOut(Easing.quad),
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
});
```
@@ -173,7 +173,7 @@ 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',
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
});
```
diff --git a/packages/skills/skills/remotion/rules/trimming.md b/packages/skills/skills/remotion/rules/trimming.md
index f20963a32d..e7534d1ce6 100644
--- a/packages/skills/skills/remotion/rules/trimming.md
+++ b/packages/skills/skills/remotion/rules/trimming.md
@@ -18,7 +18,7 @@ const fps = useVideoConfig();
<Sequence from={-0.5 * fps}>
<MyAnimation />
-</Sequence>
+</Sequence>;
```
The animation appears 15 frames into its progress - the first 15 frames are trimmed off.
@@ -29,7 +29,6 @@ Inside `<MyAnimation>`, `useCurrentFrame()` starts at 15 instead of 0.
Use `durationInFrames` to unmount content after a specified duration:
```tsx
-
<Sequence durationInFrames={1.5 * fps}>
<MyAnimation />
</Sequence>
@@ -50,4 +49,3 @@ Nest sequences to both trim the beginning and delay when it appears:
```
The inner sequence trims 15 frames from the start, and the outer sequence delays the result by 30 frames.
-