Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply best practices for creating programmatic videos with Remotion and React.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/sequencing.md
1---2name: sequencing3description: Sequencing patterns for Remotion - delay, trim, limit duration of items4metadata:5tags: sequence, series, timing, delay, trim6---78Use `<Sequence>` to delay when an element appears in the timeline.910```tsx11import { Sequence } from "remotion";1213const {fps} = useVideoConfig();1415<Sequence from={1 * fps} durationInFrames={2 * fps} premountFor={1 * fps}>16<Title />17</Sequence>18<Sequence from={2 * fps} durationInFrames={2 * fps} premountFor={1 * fps}>19<Subtitle />20</Sequence>21```2223This will by default wrap the component in an absolute fill element.24If the items should not be wrapped, use the `layout` prop:2526```tsx27<Sequence layout="none">28<Title />29</Sequence>30```3132## Premounting3334This loads the component in the timeline before it is actually played.35Always premount any `<Sequence>`!3637```tsx38<Sequence premountFor={1 * fps}>39<Title />40</Sequence>41```4243## Series4445Use `<Series>` when elements should play one after another without overlap.4647```tsx48import { Series } from "remotion";4950<Series>51<Series.Sequence durationInFrames={45}>52<Intro />53</Series.Sequence>54<Series.Sequence durationInFrames={60}>55<MainContent />56</Series.Sequence>57<Series.Sequence durationInFrames={30}>58<Outro />59</Series.Sequence>60</Series>;61```6263Same as with `<Sequence>`, the items will be wrapped in an absolute fill element by default when using `<Series.Sequence>`, unless the `layout` prop is set to `none`.6465### Series with overlaps6667Use negative offset for overlapping sequences:6869```tsx70<Series>71<Series.Sequence durationInFrames={60}>72<SceneA />73</Series.Sequence>74<Series.Sequence offset={-15} durationInFrames={60}>75{/* Starts 15 frames before SceneA ends */}76<SceneB />77</Series.Sequence>78</Series>79```8081## Frame References Inside Sequences8283Inside a Sequence, `useCurrentFrame()` returns the local frame (starting from 0):8485```tsx86<Sequence from={60} durationInFrames={30}>87<MyComponent />88{/* Inside MyComponent, useCurrentFrame() returns 0-29, not 60-89 */}89</Sequence>90```9192## Nested Sequences9394Sequences can be nested for complex timing:9596```tsx97<Sequence from={0} durationInFrames={120}>98<Background />99<Sequence from={15} durationInFrames={90} layout="none">100<Title />101</Sequence>102<Sequence from={45} durationInFrames={60} layout="none">103<Subtitle />104</Sequence>105</Sequence>106```107108## Nesting compositions within another109110To add a composition within another composition, you can use the `<Sequence>` component with a `width` and `height` prop to specify the size of the composition.111112```tsx113<AbsoluteFill>114<Sequence width={COMPOSITION_WIDTH} height={COMPOSITION_HEIGHT}>115<CompositionComponent />116</Sequence>117</AbsoluteFill>118```119