Skip to content

Transition

Playground

Overview

Signups are up 18% week on week, led by the referral channel.

Variant

Origin

Palette

Cover

Reveals

Scrub progress

Install

npm install @shavin/fx
import { FxTransition } from "@shavin/fx";

Works with

React

Client component; Next.js and any React 18+ app

Remotion

Frame-exact through FxTimeProvider or time

Route transitions in an app shell

Overview

Signups are up 18% week on week, led by the referral channel.

Component Source
import { FxTransition } from "@shavin/fx/transition";

const pathname = usePathname();

<AppFrame routeKey={pathname} sidebar={…}>
  <FxTransition routeKey={pathname} variant="slices" origin="pointer">
    {children}
  </FxTransition>
</AppFrame>

A palette instead of one tone

colors takes the shared FxPalette: "theme" derives three hues from the brand colour, or pass your own list. Bands, frames and tiles cycle through it.

Overview

Signups are up 18% week on week, led by the referral channel.

Component Source
<FxTransition routeKey={pathname} variant="slices" colors="theme" softness={0.35}>
  {children}
</FxTransition>

Image to image

With coverImage the cover is made of a picture (the outgoing slide, a brand photo), so the wipe goes straight from it to the next content.

Overview

Signups are up 18% week on week, led by the referral channel.

Component Source
<FxTransition routeKey={slide} variant="dissolve" coverImage="/assets/hq_marshall.jpg">
  <NextSlide />
</FxTransition>

From the click

origin="pointer" starts the motion where the reader pressed, for example the nav link that changed the route.

Overview

Signups are up 18% week on week, led by the referral channel.

Component Source
<FxTransition routeKey={pathname} variant="lens" origin="pointer">
  {children}
</FxTransition>

Remotion and scrubbers

progress runs from -1 (nothing covered) to 0 (covered) to 1 (cleared). Every frame is a pure function of it.

Overview

Signups are up 18% week on week, led by the referral channel.

Component Source
import { interpolate, useCurrentFrame } from "remotion";
import { FxTransition } from "@shavin/fx";

const frame = useCurrentFrame();
// -1 → 0: the cover sweeps in over scene A; 0 → 1: it clears off scene B.
const p = interpolate(frame, [0, 24, 48], [-1, 0, 1], {
  extrapolateLeft: "clamp",
  extrapolateRight: "clamp",
});

<FxTransition routeKey="intro" progress={p} variant="arcs" label="Craving…" className="absolute inset-0">
  {p < 0 ? <SceneA /> : <SceneB />}
</FxTransition>

Props

PropTypeDefaultDescription
routeKey*string—Changes on navigation (usePathname(), a tab id); nothing plays on the first render.
children*ReactNode—The next content. It renders at once, under the cover, and is revealed as the cover clears.
variant"slices" | "tunnel" | "mosaic" | "blinds" | "curtain" | "shutter" | "liquid" | "dissolve" | "arcs" | "goo" | "lens""slices"How the cover clears off the new content.
durationnumber600Total length in ms; reduced motion and data-fx-paused get a 120 ms fade.
origin"left" | "right" | "top" | "bottom" | "center" | "pointer" | { x, y }per variantWhere the motion starts. "pointer" uses the last press (the nav link that was clicked); under controlled time it falls back to the centre.
colorsFxPalette"native"Cover colours: the variant's own look, "theme" (a ramp from the brand colour), or a list of colours.
softnessnumber0 (dissolve 0.5)Feathers the moving fronts, 0 crisp to 1 soft.
coverImagestring—An image the cover is made of instead of flat colour (e.g. the outgoing slide), so the wipe goes straight from it to children.
labelstring—Arcs only: a word that lands in the final band (decorative).
direction"left" | "right""right"Deprecated, use origin. Slices retract toward this side.
scope"container" | "viewport""container"Cover the wrapper (pinned to the viewport while scrolling) or the full screen.
progressnumber—Controlled progress: 0 covered, 1 revealed; -1..0 plays the cover sweeping in. Nothing animates on its own and routeKey changes are ignored. For scrubbers and video frames.
timenumber—Controlled seconds since the transition started (or an FxTimeProvider's time); the reveal plays 0..duration. progress wins.

* required

Configure Theme
Theme
Brand Color
Custom
Gray Family
Appearance
Radius
Scaling
Panel Style
Heading Font
Body Font