Morph frame
Pro effect
Most Shavin FX effects are free. This one is part of Shavin FX Pro, in early access. Join the Pro waitlist and we will email you once when access opens. You can preview it here in the meantime.
Join the FX Pro waitlistA picture, video or any content shown in an organic window that changes shape: arch, pill, tulip, bell, circle, squircle, ticket, scoop or your own SVG path. The edge acts like a thin lens, bending the picture inward with a chromatic fringe under a rim light. Use it for an editorial hero, portfolio cards that react on hover, a scroll story, or a title that changes colour where it crosses the picture.
Playground

Shape
Media
Title
Title colour
Install
npm install @shavin/fximport { MorphFrame, MorphFrameStack, MorphFrameLabel } from "@shavin/fx";Works with
React
Client component; Next.js and any React 18+ app
Remotion
Frame-exact through FxTimeProvider, time or progress; the lens renders in Remotion's Chromium
Editorial hero
The picture's window drifts between a few related shapes while the copy stays still. Slow holds and a longer morph keep it calm enough to sit beside a headline.
Field journal
The hour before dark
Twelve evenings in the hills, photographed in the last forty minutes of light.
import { MorphFrame } from "@shavin/fx";
<div className="grid items-center gap-10 md:grid-cols-[1fr_1.1fr]">
<div className="flex flex-col gap-4">
<Text size="xs" className="uppercase tracking-widest text-fg-subtle">Field journal</Text>
<Heading size="3xl">The hour before dark</Heading>
<Text className="text-fg-subtle">Twelve evenings in the hills, photographed in the last forty minutes of light.</Text>
</div>
<MorphFrame
src={imageUrl("golden-hills-dusk", 1200)}
alt="Golden hills around a still pond at dusk"
shapes={["arch", "squircle", "tulip"]}
interval={2600}
duration={1400}
className="aspect-[4/5] w-full max-w-sm"
/>
</div>Title split by the edge
The title is real text in the page colour. Where it crosses the picture it switches to inverseColor, split at the moving edge. titleFringe adds a faint RGB offset that flares while the shape morphs.

<MorphFrame
src="/assets/hq_marshall.jpg"
alt="A Marshall speaker resting on green and gold silk"
shapes={["rect", "squircle", "arch"]}
interval={2400}
title="Listen"
subtitle="In green and gold"
titleFringe={1.2}
titleSize="clamp(2rem, 26cqw, 6rem)"
className="aspect-[3/4] w-72"
/>Portfolio cards on hover
trigger="hover" morphs from the first shape to the second while the pointer is over the frame, and back when it leaves. Starting from a rectangle keeps the grid tidy at rest.

Still life
Product photography on fabric
Portraits
Natural window light
Interiors
Rooms in afternoon sun
{projects.map((p) => (
<div key={p.name} className="flex flex-col gap-3">
<MorphFrame src={p.src} alt={p.alt} shapes={["rect", p.shape]} trigger="hover" duration={700} refraction={0.35} className="aspect-[4/5] w-full" />
<div className="flex flex-col gap-1">
<Text size="sm" className="font-medium text-fg">{p.name}</Text>
<Text size="sm" className="text-fg-subtle">{p.note}</Text>
</div>
</div>
))}Shape picker
Every preset, as buttons. trigger="manual" morphs the big frame to the shape at index, so any control (tabs, a slider, a step in a form) can choose the window.
import { MorphFrame, MORPH_SHAPES } from "@shavin/fx";
const [index, setIndex] = useState(1);
<MorphFrame src={src} alt={alt} shapes={MORPH_SHAPES} trigger="manual" index={index} duration={900} className="aspect-[3/4] w-60" />
<div role="group" aria-label="Window shape">
{MORPH_SHAPES.map((s, i) => (
<button key={s} type="button" aria-pressed={i === index} onClick={() => setIndex(i)}>
<MorphFrame src={src} alt="" shape={s} refraction={0} className="aspect-[3/4] w-10" />
{s}
</button>
))}
</div>Scroll story
MorphFrameStack lays frames down a column under hairline labels. Scroll the box: each window morphs as it rises through the view, the picture drifts a little, and a title can sit on any frame.

import { MorphFrameStack } from "@shavin/fx";
<MorphFrameStack
items={[
{ src: "/assets/hq_marshall.jpg", alt: "A Marshall speaker resting on green and gold silk", label: "Chapter 01", shapes: ["pill", "tulip"] },
{ src: imageUrl("portrait-lucia", 900), alt: "Portrait of a woman with dark hair", label: "Chapter 02", shapes: ["tulip", "bell"], title: "People", subtitle: "Portraits in window light" },
{ src: "/assets/dither-sample.mp4", alt: "A dithered video loop", label: "Chapter 03", shapes: ["bell", "arch"] },
]}
frameProps={{ titleFringe: 2, parallax: 0.12, dispersion: 0.6 }}
/>Scroll-driven
progress runs through the shapes, first (0) to last (1). Here the box's scroll position drives it, with a little parallax.
// e.g. from a scroll handler: scrollTop / (scrollHeight - clientHeight)
<MorphFrame src={imageUrl("coastal-sea-of-clouds", 900)} alt="Soft morning light over a coastline wrapped in low clouds" shapes={["circle", "arch", "tulip", "rect"]} progress={progress} parallax={0.15} />Video in a frame
An .mp4, .webm or .mov src plays muted and looped inside the window. Here it morphs from a circle to a ticket on hover.
<MorphFrame src="/assets/dither-sample.mp4" alt="A dithered video loop" shapes={["circle", "ticket"]} trigger="hover" dispersion={0.8} />Custom path
Any SVG path, drawn in a 100 by 100 viewBox (or pass your own viewBox), is resampled and morphs with the presets.
const blob = { path: "M50 4 C70 0 96 14 94 40 C92 60 100 78 82 92 C64 104 36 98 20 88 C4 78 0 58 6 40 C12 20 30 8 50 4 Z" };
<MorphFrame src={imageUrl("plant-on-violet", 900)} alt="A potted plant casting shadows on a violet wall" shapes={[blob, "squircle"]} wobble={0.8} />Driven by Remotion
Under FxTimeProvider each frame is computed from time, and images and video hold the render until they are ready.

// Every frame is a pure function of time; images and video hold the render until ready.
const frame = useCurrentFrame();
const { fps, durationInFrames } = useVideoConfig();
<FxTimeProvider time={frame / fps} hold={(label) => { const h = delayRender(label); return () => continueRender(h); }}>
{/* A morph cycle, frame-exact */}
<MorphFrame src={staticFile("still-life.jpg")} alt="" shapes={["arch", "pill", "tulip"]} />
{/* Or a whole scroll story that scrolls itself */}
<MorphFrameStack items={items} progress={frame / (durationInFrames - 1)} />
</FxTimeProvider>Browser support
The edge bend is an SVG filter on the window itself (not a backdrop filter), built from the clipped picture's own outline, so it follows every morph. Chromium (Chrome, Edge, Arc, Brave, and the headless Chrome Remotion renders with) and Firefox draw it. Safari keeps the shape, the morph, the specular rim, the inner shade and a drawn red and blue edge fringe, without the bend. The frame carries data-refraction="on" or "off" so you can check which one a reader got.
The filter re-runs whenever the picture changes, so a playing video under refraction costs more than a still; for long grids of video frames, or for small thumbnails, set refraction to 0. Under reduced motion the cycle holds the first shape, hover, manual and scroll swap shapes without animating, and the wobble, parallax and video autoplay stop.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| src | string | — | Image or video URL. .mp4, .webm and .mov play muted and looped. |
| alt | string | "" | Alt text (the video's accessible name). Empty for a decorative picture. |
| media | "image" | "video" | — | Force how src is shown when its extension does not say. |
| objectPosition | string | "center" | object-position of the picture inside the window. |
| children | ReactNode | — | Content for the window instead of (or over) src; clipped and bent with it. |
| shape | MorphShape | "arch" | rect, arch, pill, oval, circle, squircle, tulip, bell, ticket, scoop-left, scoop-right, or { path, viewBox } for any SVG path. |
| shapes | MorphShape[] | — | Shapes to morph between; overrides shape. MORPH_SHAPES lists every preset. |
| trigger | "interval" | "hover" | "scroll" | "manual" | "interval" | What moves it through shapes: a timed loop, hover (first to second), the frame's scroll position, or index. |
| index | number | 0 | For manual: the shape to morph to. |
| progress | number | — | Drive it yourself, 0 first shape to 1 last (scroll, Remotion). Overrides trigger. |
| interval | number | 1800 | For interval: ms each shape holds. |
| duration | number | 1100 | Ms a morph takes. |
| refraction | number | 0.5 | How far the picture bends inward at the edge, 0 to 1. |
| bezel | number | — | Width in px of the bending band (default 7% of the short side, 8 to 36). |
| dispersion | number | 0.4 | Chromatic fringe where the edge bends, 0 to 1. |
| rim | number | 0.6 | Specular rim light and inner edge shade, 0 to 1. |
| lightAngle | number | -45 | Direction the rim light comes from, CSS degrees (0 top). |
| wobble | number | 0.3 | Liquid wobble while a shape morphs, 0 to 1; still at rest. |
| parallax | number | 0 | With trigger="scroll" or progress: the picture drifts inside the window, 0 to 0.3. |
| radius | number | — | Corner radius in px for shapes with corners (default 7% of the short side). |
| scale | number | 1 | The window's size within the element, 0.3 to 1. |
| title | ReactNode | — | A big title over the window: color on the page, inverseColor on the picture, split at the edge. |
| subtitle | ReactNode | — | A smaller line under the title, with the same split. |
| color | FxColor | "fg" | Title colour over the page: a theme token (fg, brand, muted), any CSS colour or var(--token), or a { light, dark } pair. |
| inverseColor | FxColor | "white" | Title colour over the picture. |
| titleFringe | number | 0 | RGB-split fringe on the title in px, 0 to 6; it flares mid-morph. |
| titleSize | string | "clamp(2rem, 15cqw, 9rem)" | Title font size, relative to the frame's width by default. |
| titleClassName / titleStyle | string / CSSProperties | — | Typography for the title block. |
| time | number | — | Controlled time in seconds (e.g. frame / fps in Remotion); also read from FxTimeProvider. |
MorphFrameStack props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | { src, alt, shapes, label, title, subtitle, children }[] | — | The frames, top to bottom; each morphs between its shapes (a pair picked by position if omitted). |
| progress | number | — | Scroll the stack yourself, 0 top to 1 bottom: it fills its box and every frame's morph follows, frame-exact. Without it, a plain column following the page's scroll. |
| color / inverseColor | FxColor | — | color for labels and titles over the page, inverseColor for titles over the pictures. |
| frameProps | Partial<MorphFrameProps> | — | Passed to every frame (refraction, dispersion, titleFringe, parallax and so on). |
| frameClassName | string | "aspect-[4/5] w-full" | Classes for every frame. |
| itemClassName | string | "w-full max-w-sm" | Classes for each label and frame pair; sets the column width. |
| gap | number | 96 | Px between frames. |
| time | number | — | Controlled time in seconds; also read from FxTimeProvider. |
MorphFrameLabel props
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | The caption, set small and uppercase between two hairlines (e.g. "Chapter 01"). |
| color | FxColor | "fg" | Label colour; the hairlines use it at low opacity. |
| align | "start" | "center" | "end" | "center" | Where the caption sits between its hairlines. |