Back to Remotion

fade()

packages/docs/docs/transitions/presentations/fade.mdx

4.0.4702.3 KB
Original Source

A simple fade animation. The incoming slide fades in over the outgoing slide, while the outgoing slide does not change. Works only if the incoming slide is fully opaque.

<Demo type="fade" />

Example

tsx
import { AbsoluteFill } from "remotion";

const Letter: React.FC<{
  children: React.ReactNode;
  color: string;
}> = ({ children, color }) => {
  return (
    <AbsoluteFill
      style={{
        backgroundColor: color,
        opacity: 0.9,
        justifyContent: "center",
        alignItems: "center",
        fontSize: 200,
        color: "white",
      }}
    >
      {children}
    </AbsoluteFill>
  );
};
// ---cut---
import { linearTiming, TransitionSeries } from "@remotion/transitions";
import { fade } from "@remotion/transitions/fade";

const BasicTransition = () => {
  return (
    <TransitionSeries>
      <TransitionSeries.Sequence durationInFrames={40}>
        <Letter color="#0b84f3">A</Letter>
      </TransitionSeries.Sequence>
      <TransitionSeries.Transition
        presentation={fade()}
        timing={linearTiming({ durationInFrames: 30 })}
      />
      <TransitionSeries.Sequence durationInFrames={60}>
        <Letter color="pink">B</Letter>
      </TransitionSeries.Sequence>
    </TransitionSeries>
  );
};

API

An object which takes:

enterStyle?<AvailableFrom v="4.0.84"/>

The style of the container element when the scene is is entering.

exitStyle?<AvailableFrom v="4.0.84"/>

The style of the container element when the scene is exiting.

shouldFadeOutExitingScene?<AvailableFrom v="4.0.166"/>

Whether the exiting scene should fade out or not. Default false.

:::note The default is false because if both the entering and existing scene are semi-opaque, the whole scene will be semi-opaque, which will make the content underneath shine though.
We recommend for transitioning between fully opaque scenes setting this to false.
If the scenes are not fully covered (like fading between overlays), we recommend setting this to false. :::

Compatibility

<CompatibilityTable chrome firefox safari hideServers clientSideRendering serverSideRendering player studio />

See also