Sankey Flow
Sankey-style flows from several sources merge into one target block that counts up to the total, such as 12.4k. A free, MIT-licensed Remotion number animation.
$ pnpm dlx shadcn@latest add @remocn/sankey-flowUsage
// src/Root.tsx
import { Composition } from "remotion";
import { SankeyFlow } from "@/components/remocn/sankey-flow";
const SankeyFlowScene = () => (
<SankeyFlow
target="remocn"
label="videos rendered"
sources={[
{ label: "Marketing", value: 4100 },
{ label: "Product", value: 3200 },
{ label: "Docs", value: 2400 },
]}
/>
);
export const RemotionRoot = () => (
<Composition
id="SankeyFlow"
component={SankeyFlowScene}
durationInFrames={280}
fps={60}
width={1280}
height={720}
/>
);Source nodes appear on the left, then flows of different widths draw one by one into a single target block that lands with the combined total and label. Pass sources (label and value), target, and label; the total is the sum unless you set total. Ships dark and light via theme.
Props16
| Prop | Type | Default |
|---|---|---|
| sources | SankeySource[]DEFAULT_SOURCES Source nodes on the left, each with a label and value. | |
| target | string"remocn" Name on the merged target block. | |
| total | number— Number shown on the target; defaults to the sum of sources. | |
| label | string"videos rendered" Caption under the total. | |
| stagger | number6 Frames between flows starting. | |
| flowLength | number34 Frames for one flow to reach the target. | |
| logo | React.ReactNode— Replaces the remocn mark. | |
| accent | string"#3B5BFD" Accent color for the hero element. | |
| ink | string— Text color; overrides the theme ink. | |
| background | string— Background fill; pass "transparent" to drop it. | |
| fontFamily | string"Geist" Typeface for the copy. Load the font in your project first. | |
| scale | number1 Size of the foreground around the frame's center; the background stays put. | |
| delay | number0 Frames to hold the first frame before anything moves. | |
| grain | booleantrue Film grain over the scene. | |
| theme | "dark" | "light""dark" Dark or light palette. | |
| speed | number1 Playback multiplier. | |
- sourcesSankeySource[]
Source nodes on the left, each with a label and value.
Default
DEFAULT_SOURCES - targetstring
Name on the merged target block.
Default
"remocn" - totalnumber
Number shown on the target; defaults to the sum of sources.
- labelstring
Caption under the total.
Default
"videos rendered" - staggernumber
Frames between flows starting.
Default
6 - flowLengthnumber
Frames for one flow to reach the target.
Default
34 - logoReact.ReactNode
Replaces the remocn mark.
- accentstring
Accent color for the hero element.
Default
"#3B5BFD" - inkstring
Text color; overrides the theme ink.
- backgroundstring
Background fill; pass "transparent" to drop it.
- fontFamilystring
Typeface for the copy. Load the font in your project first.
Default
"Geist" - scalenumber
Size of the foreground around the frame's center; the background stays put.
Default
1 - delaynumber
Frames to hold the first frame before anything moves.
Default
0 - grainboolean
Film grain over the scene.
Default
true - theme"dark" | "light"
Dark or light palette.
Default
"dark" - speednumber
Playback multiplier.
Default
1
Common questions
How do I animate flows from several sources merging into one target in Remotion?
Install Sankey Flow with npx shadcn@latest add @remocn/sankey-flow and pass sources as { label, value } items. Flows of different widths draw one by one into a single target block, which lands with the combined total counting up. It is plain SVG driven by spring() and interpolate(); you don't need @remotion/paths or @remotion/shapes.
Is the 12.4k format automatic?
Yes. The target shows the sum of the source values, or total if you set it, and any number of 1000 or more is written in thousands with one decimal and a k. Sources adding up to 12400 read 12.4k. There is no M suffix: 1,500,000 would read 1500.0k, so for millions edit the fmt function in the copied file.
How many sources can I pass?
Up to six; extra items are ignored.
How long is it?
With the default five sources the total lands and the caption settles by frame 98 at 30 fps. Each extra source adds stagger frames (default 6). The timing is the same at any frame rate: in a 60 fps composition give it at least 196 frames. The usage example's 280 frames at 60 fps adds a hold, and a slow push-in keeps easing until frame 150 at 30 fps (300 at 60 fps).
Does it work in portrait?
It scales to the frame but is laid out for 16:9, with sources on the left and the total to the right of the target.
Related effects
- Share Donut: shares of a whole as a percentage.
- Treemap Split: parts as rectangles sized by value.
- Compact Stat: one headline metric with no breakdown.