π₯ Make videos programmatically with React
Update transitions.mdx
JonnyBurgerc92cc68457a5
diff --git a/packages/docs/docs/transitions.mdx b/packages/docs/docs/transitions.mdxindex 782d2536f2..f63cf7ba2f 100644--- a/packages/docs/docs/transitions.mdx+++ b/packages/docs/docs/transitions.mdx@@ -11,7 +11,11 @@ import { TransitionsDuration } from "../components/TransitionsDuration";import { Presentations } from "../components/TableOfContents/transitions/presentations";import { Timings } from "../components/TableOfContents/transitions/timings";-To transition between two types of absolutely positioned content, you can use the [`<TransitionSeries>`](/docs/transitions/transitionseries) component.+The [`<TransitionSeries>`](/docs/transitions/transitionseries) component lets you animate between absolutely positioned scenes. Between any two sequences, you can place a [`<TransitionSeries.Transition>`](/docs/transitions/transitionseries#transitionseriestransition) or a [`<TransitionSeries.Overlay>`](/docs/transitions/transitionseries#transitionseriesoverlay).++## Transitions++A transition animates from one scene to the next. During the transition, both scenes render simultaneously and the total duration is [shortened](/docs/transitions/transitionseries#duration-of-a-transitionseries).```tsx twoslash title="SlideTransition.tsx"import { AbsoluteFill } from "remotion";@@ -59,22 +63,67 @@ const BasicTransition = () => {<Demo type="slide" />-## Enter and exit animations+### Enter and exit animations-You don't necessarily have to use `<TransitionSeries>` for transitions between scenes. You can also use it to animate the entrace or exit of a scene by putting a transition first or last in the `<TransitionSeries>`.+You can also animate the entrance or exit of a scene by putting a transition first or last in the `<TransitionSeries>`.[See example](/docs/transitions/transitionseries#enter-and-exit-animations)-## Duration+### Duration-In the above example, `A` is visible for 40 frames, `B` for 60 frames and the duration of the transition is 30 frames.+In the above example, `A` is visible for 40 frames, `B` for 60 frames and the duration of the transition is 30 frames.During this time, both slides are rendered. This means the total duration of the animation is `60 + 40 - 30 = 70`.<TransitionsDuration />+### Getting the duration of a transition++You can get the duration of a transition by calling `getDurationInFrames()` on the timing:++```tsx twoslash title="Assuming a framerate of 30fps"+import { springTiming } from "@remotion/transitions";++springTiming({ config: { damping: 200 } }).getDurationInFrames({ fps: 30 }); // 23+```++## Overlays<AvailableFrom v="4.0.415"/>++An [`<TransitionSeries.Overlay>`](/docs/transitions/transitionseries#transitionseriesoverlay) renders children on top of the junction between two sequences without shortening the timeline. The sequences remain at full length β the total duration stays the same.++This is useful for effects like [light leaks](/docs/light-leaks/light-leak), flashes, or other visual elements that should appear over a cut without affecting timing. The overlay is centered on the cut point by default.++```tsx twoslash title="OverlayExample.tsx"+import {AbsoluteFill} from 'remotion';+const Fill = ({color}: {color: string}) => <AbsoluteFill style={{backgroundColor: color}} />;++// ---cut---+import {LightLeak} from '@remotion/light-leaks';+import {TransitionSeries} from '@remotion/transitions';++const OverlayExample = () => {+ return (+ <TransitionSeries>+ <TransitionSeries.Sequence durationInFrames={60}>+ <Fill color="#0b84f3" />+ </TransitionSeries.Sequence>+ <TransitionSeries.Overlay durationInFrames={20}>+ <LightLeak />+ </TransitionSeries.Overlay>+ <TransitionSeries.Sequence durationInFrames={60}>+ <Fill color="pink" />+ </TransitionSeries.Sequence>+ </TransitionSeries>+ );+};+```++<Demo type="transition-series-overlay" />++See [`<TransitionSeries.Overlay>`](/docs/transitions/transitionseries#transitionseriesoverlay) for full API details.+## Presentations-A presentation determines the visual of animation.+A presentation determines the visual of the animation.<Presentations />@@ -88,32 +137,17 @@ A timing determines how long the animation takes and the animation curve.See here how to include [audio effects](/docs/transitions/audio-transitions) in your transitions.-## Getting the duration of a transition--You can get the duration of a transition by calling `getDurationInFrames()` on the timing:--```tsx twoslash title="Assuming a framerate of 30fps"-import { springTiming } from "@remotion/transitions";--springTiming({ config: { damping: 200 } }).getDurationInFrames({ fps: 30 }); // 23-```--## Overlays+## Rules-You can use `<TransitionSeries.Overlay>` to render content on top of the junction between two sequences without shortening the timeline. Unlike transitions, overlays do not cause the sequences to overlap β the total duration stays the same. The overlay is centered on the cut point by default.+<Step>1</Step> A transition must not be longer than the duration of the previous or next sequence.-This is useful for rendering effects like light leaks, flashes, or other visual elements that should appear over a cut without affecting timing.+<Step>2</Step> Two transitions cannot be adjacent.-See [`<TransitionSeries.Overlay>`](/docs/transitions/transitionseries#transitionseriesoverlay) for details.+<Step>3</Step> Two overlays cannot be adjacent.-## Rules+<Step>4</Step> A transition and an overlay cannot be adjacent β they occupy the same slot between sequences.-<Step>1</Step> It is forbidden to have a transition that is longer than the duration-of the previous or next sequence. <br />-<Step>2</Step> There can be no two transitions next to each other. <br />-<Step>3</Step> There must be at least one sequence before or after a transition. <br />-<Step>4</Step> An overlay and a transition cannot be adjacent. <br />-<Step>5</Step> Two overlays cannot be adjacent.+<Step>5</Step> There must be at least one sequence before or after a transition or overlay.## See also