Skip to main content

swap()v4.0.466

A presentation that swaps scenes with perspective, depth, and a floor reflection.

Example​

SwapTransition.tsx
import {linearTiming, TransitionSeries} from '@remotion/transitions'; import {swap} from '@remotion/transitions/swap'; const BasicTransition = () => { return ( <TransitionSeries> <TransitionSeries.Sequence durationInFrames={40}> <Letter color="#0b84f3">A</Letter> </TransitionSeries.Sequence> <TransitionSeries.Transition presentation={swap({})} timing={linearTiming({durationInFrames: 30})} /> <TransitionSeries.Sequence durationInFrames={60}> <Letter color="pink">B</Letter> </TransitionSeries.Sequence> </TransitionSeries> ); };

API​

Accepts an object with the following options:

reflection?​

Controls the strength of the reflected scenes on the floor.

Defaults to 0.4.

perspective?​

Controls the perspective distortion while the scenes move.

Defaults to 0.2.

depth?​

Controls how far each scene moves into depth during the swap.

Defaults to 3.

effects?​

Effects to apply after the transition shader. See makeHtmlInCanvasPresentation().

effectsOutputSize?v4.0.536​

Sets the effect resolution. See makeHtmlInCanvasPresentation().

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

Previewing this presentation requires Chrome 157 or later.

Credits​

The fragment shader is adapted from the swap GL Transition by gre, licensed under MIT.

See also​