🎥 Make videos programmatically with React
Skills: Prefer standalone <AbsoluteFill> layers
Jonny Burger11b004363531
diff --git a/packages/brand/src/WebMCPPromo/MacBookScene.tsx b/packages/brand/src/WebMCPPromo/MacBookScene.tsxindex 92b2d0a3fd..bf13f5587e 100644--- a/packages/brand/src/WebMCPPromo/MacBookScene.tsx+++ b/packages/brand/src/WebMCPPromo/MacBookScene.tsx@@ -559,17 +559,15 @@ export const MacBookLoopScene = () => {<AbsoluteFill><MacBookScene /></AbsoluteFill>- <Sequence+ <AbsoluteFilldurationInFrames={25}freeze={0}from={775}- layout="none"name="Beginning crossfade"+ style={{opacity: incomingOpacity}}>- <AbsoluteFill style={{opacity: incomingOpacity}}>- <MacBookScene />- </AbsoluteFill>- </Sequence>+ <MacBookScene />+ </AbsoluteFill></>);};diff --git a/packages/brand/src/announcements/whats-new-in-remotion/Scene2.tsx b/packages/brand/src/announcements/whats-new-in-remotion/Scene2.tsxindex 019765d1a5..551eaaec84 100644--- a/packages/brand/src/announcements/whats-new-in-remotion/Scene2.tsx+++ b/packages/brand/src/announcements/whats-new-in-remotion/Scene2.tsx@@ -78,15 +78,13 @@ export const Scene2: React.FC = () => {})()}</Sequence>{llOpacity > 0 && (- <Sequence+ <AbsoluteFillfrom={Math.floor(llStart)}durationInFrames={Math.ceil(llEnd - llStart)}- layout="none"+ style={{opacity: llOpacity}}>- <AbsoluteFill style={{opacity: llOpacity}}>- <LightLeakGrid durationInFrames={Math.ceil(llEnd - llStart)} />- </AbsoluteFill>- </Sequence>+ <LightLeakGrid durationInFrames={Math.ceil(llEnd - llStart)} />+ </AbsoluteFill>)}</AbsoluteFill>);diff --git a/packages/codex-plugin/skills/remotion-best-practices/remotion-interactivity/REFERENCE.md b/packages/codex-plugin/skills/remotion-best-practices/remotion-interactivity/REFERENCE.mdindex ac4a9287c1..a49c81a6fc 100644--- a/packages/codex-plugin/skills/remotion-best-practices/remotion-interactivity/REFERENCE.md+++ b/packages/codex-plugin/skills/remotion-best-practices/remotion-interactivity/REFERENCE.md@@ -59,6 +59,21 @@ Avoid computed names, hardcode them.</>```+## Use AbsoluteFill directly for layers++`<AbsoluteFill>` is already interactive and appears in the timeline.+Give it a `name` and set `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` or `showInTimeline` directly on it.+Do not add an outer `<Sequence>` just to name or time a single `<AbsoluteFill>`.++```tsx title="Standalone background layer"+<AbsoluteFill+ name="Background"+ from={30}+ durationInFrames={90}+ style={{background: 'linear-gradient(135deg, #0f172a, #312e81)'}}+/>+```+## Keep all CSS styles inlineThe best way is to just pass a plain object to `style` - no referring to constants, no object spreading, no math.diff --git a/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/sequencing.md b/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/sequencing.mdindex 83c7ea03b8..0c9649d659 100644--- a/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/sequencing.md+++ b/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/sequencing.md@@ -5,7 +5,26 @@ metadata:tags: sequence, series, timing, delay, trim----Use `<Sequence>` to delay when an element appears in the timeline.+Use `<Sequence>` to delay when a group or custom component appears in the timeline.++## Use AbsoluteFill directly for layers++`<AbsoluteFill>` already supports `name`, `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` and `showInTimeline`.+Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequence>` whose only child is that layer.++```tsx title="Standalone background layer"+<AbsoluteFill+ name="Background"+ from={30}+ durationInFrames={90}+ style={{background: 'linear-gradient(135deg, #0f172a, #312e81)'}}+/>+```++Keep an outer `<Sequence>` when it groups multiple children or supplies features such as premounting, postmounting or `width` / `height` overrides.+Timing props on `<AbsoluteFill>` apply to its descendants, including their `useCurrentFrame()` calls.++## Timing custom components```tsxconst Main = () => {diff --git a/packages/codex-plugin/skills/remotion-interactivity/SKILL.md b/packages/codex-plugin/skills/remotion-interactivity/SKILL.mdindex ac4a9287c1..a49c81a6fc 100644--- a/packages/codex-plugin/skills/remotion-interactivity/SKILL.md+++ b/packages/codex-plugin/skills/remotion-interactivity/SKILL.md@@ -59,6 +59,21 @@ Avoid computed names, hardcode them.</>```+## Use AbsoluteFill directly for layers++`<AbsoluteFill>` is already interactive and appears in the timeline.+Give it a `name` and set `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` or `showInTimeline` directly on it.+Do not add an outer `<Sequence>` just to name or time a single `<AbsoluteFill>`.++```tsx title="Standalone background layer"+<AbsoluteFill+ name="Background"+ from={30}+ durationInFrames={90}+ style={{background: 'linear-gradient(135deg, #0f172a, #312e81)'}}+/>+```+## Keep all CSS styles inlineThe best way is to just pass a plain object to `style` - no referring to constants, no object spreading, no math.diff --git a/packages/codex-plugin/skills/remotion-markup/sequencing.md b/packages/codex-plugin/skills/remotion-markup/sequencing.mdindex 83c7ea03b8..0c9649d659 100644--- a/packages/codex-plugin/skills/remotion-markup/sequencing.md+++ b/packages/codex-plugin/skills/remotion-markup/sequencing.md@@ -5,7 +5,26 @@ metadata:tags: sequence, series, timing, delay, trim----Use `<Sequence>` to delay when an element appears in the timeline.+Use `<Sequence>` to delay when a group or custom component appears in the timeline.++## Use AbsoluteFill directly for layers++`<AbsoluteFill>` already supports `name`, `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` and `showInTimeline`.+Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequence>` whose only child is that layer.++```tsx title="Standalone background layer"+<AbsoluteFill+ name="Background"+ from={30}+ durationInFrames={90}+ style={{background: 'linear-gradient(135deg, #0f172a, #312e81)'}}+/>+```++Keep an outer `<Sequence>` when it groups multiple children or supplies features such as premounting, postmounting or `width` / `height` overrides.+Timing props on `<AbsoluteFill>` apply to its descendants, including their `useCurrentFrame()` calls.++## Timing custom components```tsxconst Main = () => {diff --git a/packages/docs/docs/absolute-fill.mdx b/packages/docs/docs/absolute-fill.mdxindex 134b599c7d..bdac7f6e9a 100644--- a/packages/docs/docs/absolute-fill.mdx+++ b/packages/docs/docs/absolute-fill.mdx@@ -53,16 +53,16 @@ The layers that get rendered last appear on top - this is because of how HTML woIt is registered as a layer in the [Remotion Studio](/docs/studio) timeline.-:::note-You can still wrap `<AbsoluteFill>` in an outer [`<Sequence>`](/docs/sequence). Timing [cascades](/docs/sequence#cascading) like nested sequences.-:::+Pass these props directly to `<AbsoluteFill>` instead of adding an outer `<Sequence>` just to name or time the layer.+Use an outer `<Sequence>` when grouping multiple children or using features such as [premounting](/docs/sequence#premountfor) or [width and height overrides](/docs/sequence#width).+When nesting them, timing [cascades](/docs/sequence#cascading) like nested sequences.```tsx twoslash title="Clip starting at frame 30, lasting 90 frames"import {AbsoluteFill} from 'remotion';export const MyComp: React.FC = () => {return (- <AbsoluteFill from={30} durationInFrames={90}>+ <AbsoluteFill name="Background" from={30} durationInFrames={90}>This layer is visible from frame 30 to 119.</AbsoluteFill>);diff --git a/packages/example/src/VisualMode3D.tsx b/packages/example/src/VisualMode3D.tsxindex b29f6b2e55..d1ee1bd123 100644--- a/packages/example/src/VisualMode3D.tsx+++ b/packages/example/src/VisualMode3D.tsx@@ -1,17 +1,15 @@import React from 'react';-import {AbsoluteFill, Sequence} from 'remotion';+import {AbsoluteFill} from 'remotion';export const VisualMode3D: React.FC = () => {return (<AbsoluteFill style={{backgroundColor: '#111', perspective: 800}}>- <Sequence+ <AbsoluteFillname="2D transform"durationInFrames={120}- style={{height: 400, scale: 1, width: 400}}- >- <AbsoluteFill style={{backgroundColor: '#0b84ff'}} />- </Sequence>- <Sequence+ style={{height: 400, scale: 1, width: 400, backgroundColor: '#0b84ff'}}+ />+ <AbsoluteFillname="3D transform"durationInFrames={120}style={{@@ -21,11 +19,10 @@ export const VisualMode3D: React.FC = () => {transformOrigin: '50% 50% 10px',translate: '500px 500px',width: 400,+ backgroundColor: '#ff4d8d',}}- >- <AbsoluteFill style={{backgroundColor: '#ff4d8d'}} />- </Sequence>- <Sequence+ />+ <AbsoluteFillname="Tiny transform"durationInFrames={120}style={{@@ -34,10 +31,9 @@ export const VisualMode3D: React.FC = () => {scale: 1,translate: '450px 450px',width: 8,+ backgroundColor: '#44cc88',}}- >- <AbsoluteFill style={{backgroundColor: '#44cc88'}} />- </Sequence>+ /></AbsoluteFill>);};diff --git a/packages/player-example/src/BrowserBundlerExample.tsx b/packages/player-example/src/BrowserBundlerExample.tsxindex 6c553d5d09..bd55dfc2f9 100644--- a/packages/player-example/src/BrowserBundlerExample.tsx+++ b/packages/player-example/src/BrowserBundlerExample.tsx@@ -25,9 +25,7 @@ export const Video: React.FC<{title: string; accent: string}> = ({title, accent}backgroundColor: '#0f172a', color: 'white', fontFamily: 'sans-serif',justifyContent: 'center', padding: 80,}}>- <Sequence name="Background" layout="none">- <AbsoluteFill style={{background: 'linear-gradient(135deg, #0f172a, #312e81)'}} />- </Sequence>+ <AbsoluteFill name="Background" style={{background: 'linear-gradient(135deg, #0f172a, #312e81)'}} /><Sequence name="Orb" layout="none"><Orb accent={accent} /></Sequence>diff --git a/packages/skills/skills/remotion-interactivity/SKILL.md b/packages/skills/skills/remotion-interactivity/SKILL.mdindex ee73648839..647ca10fc4 100644--- a/packages/skills/skills/remotion-interactivity/SKILL.md+++ b/packages/skills/skills/remotion-interactivity/SKILL.md@@ -59,6 +59,21 @@ Avoid computed names, hardcode them.</>```+## Use AbsoluteFill directly for layers++`<AbsoluteFill>` is already interactive and appears in the timeline.+Give it a `name` and set `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` or `showInTimeline` directly on it.+Do not add an outer `<Sequence>` just to name or time a single `<AbsoluteFill>`.++```tsx title="Standalone background layer"+<AbsoluteFill+ name="Background"+ from={30}+ durationInFrames={90}+ style={{background: 'linear-gradient(135deg, #0f172a, #312e81)'}}+/>+```+## Keep all CSS styles inlineThe best way is to just pass a plain object to `style` - no referring to constants, no object spreading, no math.diff --git a/packages/skills/skills/remotion-markup/sequencing.md b/packages/skills/skills/remotion-markup/sequencing.mdindex 83c7ea03b8..0c9649d659 100644--- a/packages/skills/skills/remotion-markup/sequencing.md+++ b/packages/skills/skills/remotion-markup/sequencing.md@@ -5,7 +5,26 @@ metadata:tags: sequence, series, timing, delay, trim----Use `<Sequence>` to delay when an element appears in the timeline.+Use `<Sequence>` to delay when a group or custom component appears in the timeline.++## Use AbsoluteFill directly for layers++`<AbsoluteFill>` already supports `name`, `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` and `showInTimeline`.+Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequence>` whose only child is that layer.++```tsx title="Standalone background layer"+<AbsoluteFill+ name="Background"+ from={30}+ durationInFrames={90}+ style={{background: 'linear-gradient(135deg, #0f172a, #312e81)'}}+/>+```++Keep an outer `<Sequence>` when it groups multiple children or supplies features such as premounting, postmounting or `width` / `height` overrides.+Timing props on `<AbsoluteFill>` apply to its descendants, including their `useCurrentFrame()` calls.++## Timing custom components```tsxconst Main = () => {diff --git a/packages/template-prompt-to-motion-graphics/src/skills/sequencing.md b/packages/template-prompt-to-motion-graphics/src/skills/sequencing.mdindex 1543f97f69..fdcc511a39 100644--- a/packages/template-prompt-to-motion-graphics/src/skills/sequencing.md+++ b/packages/template-prompt-to-motion-graphics/src/skills/sequencing.md@@ -5,6 +5,23 @@ impactDescription: controls when elements appear and enables complex choreographtags: sequence, series, timing, delay, choreography---+## Use AbsoluteFill directly for layers++`<AbsoluteFill>` already supports `name`, `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` and `showInTimeline`.+Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequence>` whose only child is that layer.++```tsx title="Standalone background layer"+<AbsoluteFill+ name="Background"+ from={30}+ durationInFrames={90}+ style={{background: 'linear-gradient(135deg, #0f172a, #312e81)'}}+/>+```++Keep an outer `<Sequence>` when it groups multiple children or supplies features such as premounting, postmounting or `width` / `height` overrides.+Timing props on `<AbsoluteFill>` apply to its descendants, including their `useCurrentFrame()` calls.+## Sequence for Delayed ElementsUse Sequence to delay when an element appears in the timeline.diff --git a/packages/template-prompt-to-video/src/components/AIVideo.tsx b/packages/template-prompt-to-video/src/components/AIVideo.tsxindex 7d23ab829e..6fdae87731 100644--- a/packages/template-prompt-to-video/src/components/AIVideo.tsx+++ b/packages/template-prompt-to-video/src/components/AIVideo.tsx@@ -25,34 +25,33 @@ export const AIVideo: React.FC<z.infer<typeof aiVideoSchema>> = ({return (<AbsoluteFill style={{ backgroundColor: "white" }}>- <Sequence durationInFrames={INTRO_DURATION}>- <AbsoluteFill+ <AbsoluteFill+ durationInFrames={INTRO_DURATION}+ style={{+ justifyContent: "center",+ alignItems: "center",+ textAlign: "center",+ display: "flex",+ zIndex: 10,+ }}+ >+ <divstyle={{- justifyContent: "center",- alignItems: "center",- textAlign: "center",- display: "flex",- zIndex: 10,+ fontSize: 120,+ lineHeight: "122px",+ width: "87%",+ color: "black",+ fontFamily,+ textTransform: "uppercase",+ backgroundColor: "yellow",+ paddingTop: 20,+ paddingBottom: 20,+ border: "10px solid black",}}>- <div- style={{- fontSize: 120,- lineHeight: "122px",- width: "87%",- color: "black",- fontFamily,- textTransform: "uppercase",- backgroundColor: "yellow",- paddingTop: 20,- paddingBottom: 20,- border: "10px solid black",- }}- >- {timeline.shortTitle}- </div>- </AbsoluteFill>- </Sequence>+ {timeline.shortTitle}+ </div>+ </AbsoluteFill>{timeline.elements.map((element, index) => {const { startFrame, duration } = calculateFrameTiming(