Opus Motion ★ Star on GitHub

Data · sankey-flow

Sankey flow

A Sankey diagram built from a list of weighted links: node bars grow column by column and curved ribbons, sized by value and coloured source-to-target, sweep across between them with labels and values; an optional highlighted node dims everything not connected to it.

A free, MIT-licensed animated chart from the Opus Motion Library — 616 motions for Remotion, React and plain HTML.

Sankey flow: three frames of the animated chart, start, middle and end
Sankey flow — start, middle and end of the 7.0-second motion.

What Sankey flow is for

Where things go: traffic to conversions, budget to departments, energy or cash flows, funnels with leaks, user journeys. Pass links as [{from, to, value}], set prefix / suffix and brand colours; works on a transparent background over footage.

  • sankey
  • flow
  • links
  • diagram
  • chart
  • funnel
  • budget
  • journey
  • conversion
  • allocation
  • infographic
  • data
  • overlay
  • statistics

Details

Category
Animated charts & data visualisation
Length
7.0 s (210 frames at 30 fps)
Formats
16:9, 1:1, 9:16
Weight
light
Transparent overlay
yes
Seamless loop
no
Text props
title subtitle prefix
Colour props
colors background ink
Mood
hud
Roles
accent, subject

Use Sankey flow in Remotion, React or HTML

Remotion project

terminal
# copy this motion into your Remotion project
node cli/mgl.mjs add sankey-flow --to ../my-app/src

# render an mp4 (run in the library folder)
node cli/mgl.mjs render sankey-flow --props '{"title":"Where visitors go","subtitle":"Monthly sessions from first touch to paying customer","prefix":"","colors":["#2F6FED","#FF7A45","#16B39A","#F2B134","#8E5CF0","#E5487F","#5BC0EB","#7A8794"],"background":"#F5F3EE","ink":"#18212B"}'

# or export for apps / editors: mp4 | webm-alpha | prores-alpha | gif | png | poster
node cli/mgl.mjs export sankey-flow --as webm-alpha --props '{"title":"Where visitors go","subtitle":"Monthly sessions from first touch to paying customer","prefix":"","colors":["#2F6FED","#FF7A45","#16B39A","#F2B134","#8E5CF0","#E5487F","#5BC0EB","#7A8794"],"background":"#F5F3EE","ink":"#18212B"}'

React / Next.js

tsx
import {MotionPlayer} from 'opus-motion-library/web';

<MotionPlayer
  motion="sankey-flow"
  props={{
    title: 'Where visitors go',
    subtitle: 'Monthly sessions from first touch to paying customer',
    prefix: '',
    colors: [
      '#2F6FED',
      '#FF7A45',
      '#16B39A',
      '#F2B134',
      '#8E5CF0',
      '#E5487F',
      '#5BC0EB',
      '#7A8794',
    ],
    background: '#F5F3EE',
    ink: '#18212B',
  }}
  playOnView
  loop="auto"
/>

Plain HTML / WordPress

html
<script src="opus-motion.element.js" defer></script>

<opus-motion motion="sankey-flow"
  props='{"title":"Where visitors go","subtitle":"Monthly sessions from first touch to paying customer","prefix":"","colors":["#2F6FED","#FF7A45","#16B39A","#F2B134","#8E5CF0","#E5487F","#5BC0EB","#7A8794"],"background":"#F5F3EE","ink":"#18212B"}'>
</opus-motion>

Compose spec (multi-scene video)

json
{
  "width": 1920,
  "height": 1080,
  "fps": 30,
  "scenes": [
    {
      "motion": "sankey-flow",
      "props": {
        "title": "Where visitors go",
        "subtitle": "Monthly sessions from first touch to paying customer",
        "prefix": "",
        "colors": [
          "#2F6FED",
          "#FF7A45",
          "#16B39A",
          "#F2B134",
          "#8E5CF0",
          "#E5487F",
          "#5BC0EB",
          "#7A8794"
        ],
        "background": "#F5F3EE",
        "ink": "#18212B"
      }
    }
  ]
}

Sankey flow props

20 parameters — change any of them to make the motion yours.

PropDefaultWhat it does
links[{"from":"Organic","to":"Visitors","value":420},{"from":"Paid","to":"Visitors","value":…weighted links [{from, to, value, color?}]; nodes are created from the names, columns follow the flow direction
nodeColors{"Visitors":"#8E5CF0","Bounced":"#9AA3AD","Inactive":"#B8BEC5","Paying":"#12A150","Chur…optional node name -> colour overrides, e.g. {"Paid":"#E5487F"}
title"Where visitors go"headline (empty = none)
subtitle"Monthly sessions from first touch to paying customer"small line under the headline (empty = none)
prefix""text before every number, e.g. "$"
suffix""text after every number, e.g. "K", " users"
decimals0decimal places on the numbers
showValuestrueprint each node total (tall nodes: under the name, short nodes: next to it)
linkMode"gradient"ribbon colour: "gradient" (source to target), "source" or "target"
linkOpacity0.5ribbon opacity 0-1
nodeWidth26node bar width in u
nodePad22vertical gap between nodes of a column in u
align"left""justify" pushes end nodes to the last column, "left" keeps them where they land
highlight""node name to spotlight at the end (empty = none); unrelated nodes and links dim
colors["#2F6FED","#FF7A45","#16B39A","#F2B134","#8E5CF0","#E5487F","#5BC0EB","#7A8794"]palette used for nodes without an override
background"#F5F3EE"page colour, or "transparent" to sit over other content
ink"#18212B"text colour
fontFamily""CSS font family (empty = Space Grotesk)
startAt8frame the first column appears
speed1animation speed multiplier

Notes & credits

Technique sources:

  • original round-3 chart motion