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/trimming.md
1---2name: trimming3description: Trimming patterns for Remotion - cut the beginning or end of animations4metadata:5tags: sequence, trim, clip, cut, offset6---78Use `<Sequence>` with a negative `from` value to trim the start of an animation.910## Trim the Beginning1112A negative `from` value shifts time backwards, making the animation start partway through:1314```tsx15import { Sequence, useVideoConfig } from "remotion";1617const fps = useVideoConfig();1819<Sequence from={-0.5 * fps}>20<MyAnimation />21</Sequence>;22```2324The animation appears 15 frames into its progress - the first 15 frames are trimmed off.25Inside `<MyAnimation>`, `useCurrentFrame()` starts at 15 instead of 0.2627## Trim the End2829Use `durationInFrames` to unmount content after a specified duration:3031```tsx32<Sequence durationInFrames={1.5 * fps}>33<MyAnimation />34</Sequence>35```3637The animation plays for 45 frames, then the component unmounts.3839## Trim and Delay4041Nest sequences to both trim the beginning and delay when it appears:4243```tsx44<Sequence from={30}>45<Sequence from={-15}>46<MyAnimation />47</Sequence>48</Sequence>49```5051The inner sequence trims 15 frames from the start, and the outer sequence delays the result by 30 frames.52