swap()v4.0.466
A presentation that swaps scenes with perspective, depth, and a floor reflection.
warning
This presentation is built with HTML-in-canvas and requires Google Chrome with chrome://flags/#canvas-draw-element enabled. It does not work in Firefox or Safari.
Example
SwapTransition.tsximport {linearTiming ,TransitionSeries } from '@remotion/transitions'; import {swap } from '@remotion/transitions/swap'; constBasicTransition = () => { 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.
Compatibility
| Browsers | Servers | Environments | |||||||
|---|---|---|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | Node.js | Bun | Serverless Functions | ||||
For Preview, Chrome with the chrome://flags/#canvas-draw-element flag enabled is required.
Credits
The fragment shader is adapted from the swap GL Transition by gre, licensed under MIT.