Skip to content
animorio
IT
Back to the library

Money flow Sankey

SVG, HoverGSAPAdvancedCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

The money flow card of an invented banking app, dark and premium like a Dribbble shot: the month's income (salary, freelance work, refunds) comes into the checking account and leaves again towards savings, investing, rent, groceries and everyday spending. Every flow is an SVG ribbon as thick as its money, a Sankey diagram that draws itself from left to right while the accounts grow. Touching a ribbon or an account lights it up with its glow, the others step back and a glass tooltip follows it on a spring with the amount and the share; pressed, the ribbon swells and settles. Sep and Oct morph every ribbon into the other month with a touch of bounce while the figures roll.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Money flow Sankey" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>The Sankey chart of the money flow between accounts</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the money flow card of a banking app, Fernhall: the month's income comes in from three sources, gathers in the
         checking account and leaves again towards rent, savings, investing, groceries and everyday spending. Every
         flow is a ribbon as thick as its money, drawn in SVG; a soft streak of light runs along each one. Touching a
         ribbon or an account lights it up, the others step back, a glass tooltip rides along it and the ribbon
         swells on a spring when pressed. Sep and Oct morph the ribbons and roll the figures -->
    <article class="flow" data-card aria-label="Money flow for October">
      <span class="flow__light" aria-hidden="true"></span>
      <header class="flow__head">
        <div class="flow__brand">
          <svg class="flow__mark" viewBox="0 0 20 20" aria-hidden="true">
            <path d="M3 6.5c5 0 7 7 14 7" />
            <path d="M3 13.5c5 0 7-7 14-7" />
          </svg>
          <span class="flow__title">Money flow</span>
        </div>
        <div class="flow__seg" role="tablist" aria-label="Month" data-seg>
          <span class="flow__seg-pill" data-pill aria-hidden="true"></span>
          <button class="flow__seg-btn" type="button" role="tab" aria-selected="false" data-month="1">Sep</button>
          <button class="flow__seg-btn is-on" type="button" role="tab" aria-selected="true" data-month="0">Oct</button>
        </div>
      </header>

      <div class="flow__sum">
        <p class="flow__total"><span class="roll" data-total>$0,000</span></p>
        <p class="flow__meta">
          <span class="flow__chip">
            <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 7.6L6 4.6l3 3" /></svg>
            <span class="roll" data-delta>+0.0%</span>
          </span>
          <span class="flow__sub" data-sub>in this month</span>
        </p>
      </div>

      <div class="flow__chart" data-chart>
        <svg class="flow__svg" data-svg role="img" aria-label="Income of 8,420 dollars flowing through checking into rent, savings, investing, groceries and everyday spending">
          <defs data-defs></defs>
          <g data-links></g>
          <g data-nodes></g>
          <g data-labels></g>
          <g class="flow__mark-on" data-tick aria-hidden="true">
            <line data-tick-line />
          </g>
        </svg>
        <div class="flow__tip" data-tip aria-hidden="true">
          <span class="flow__tip-path"><span data-tip-from>Salary</span>
            <svg viewBox="0 0 12 12"><path d="M2.5 6h7M6.8 3.3L9.5 6 6.8 8.7" /></svg>
            <span data-tip-to>Checking</span></span>
          <span class="flow__tip-value" data-tip-value>$6,200</span>
          <span class="flow__tip-share" data-tip-share>74% of income</span>
        </div>
      </div>

      <footer class="flow__foot">
        <span class="flow__foot-name">Savings rate</span>
        <span class="flow__track" aria-hidden="true"><span class="flow__fill" data-fill></span></span>
        <span class="flow__foot-value"><span class="roll" data-rate>00</span>%</span>
      </footer>
    </article>
    <p class="sr" aria-live="polite" data-live></p>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

31 values to change

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Money flow Sankey” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a near black page with two soft lights, a teal one at the top left and a violet one at the bottom right, and a fine grain, a dark card with round corners rises: at the top the Fernhall mark and ‘Money flow’, on the right the Sep and Oct switch with its pill under the chosen month; below, the month's income, ‘$8,420’, rolling digit by digit from zero, the green ‘+6.3%’ chip and ‘in October’. Then the diagram draws itself: on the left Salary, Freelance and Refunds grow as three green bars and their ribbons run to the Checking account in the middle, which rises light grey; from there five ribbons leave again towards Savings and Investing, violet, and Rent, Groceries and Everyday, amber, each one exactly as thick as its money, the colour fading from the account it leaves to the one it reaches and the top edge catching the light in one pixel. The salary ribbon lights up: the others step back, a green glow grows around it, a streak of light runs along it faster, a white tick crosses it and beside it a frosted glass tooltip says ‘Salary → Checking, $6,200, 74% of income’ while gliding along the ribbon on a spring; the ribbon is pressed, swells by three pixels and comes back with a bounce. The tooltip moves to the savings ribbon, then the switch goes to Sep: every ribbon changes thickness together and passes the mark by a breath, the accounts shift, the figures roll to ‘$7,920’ and ‘+3.7%’, the savings rate bar drops from 44 to 37. The Everyday ribbon lights up, it goes back to Oct, and the ribbons leave to the right before the loop starts again. With the pointer the ribbon or account under the mouse lights up, on the phone the one touched.

How it works

A diagram in pixels

The SVG has a viewBox as big as its box, re-measured with a ResizeObserver: every frame the layout is worked out again in pixels. One scale (pixels per dollar) holds for every account, taken from the richer month, so September really is thinner.

The ribbons

Every flow is a closed path made of two Bézier curves, the top edge and the bottom one, with the control points halfway (CURVE). Each ribbon takes its slot on the side of the account it leaves and of the one it reaches, one under the other. The fill is a userSpaceOnUse gradient from one account's colour to the other's.

Drawing itself

Every ribbon has its own clipPath, a rectangle that widens from left to right (draw) and on the way out shrinks from the left (undraw): so the fill, the thread of light on the edge and the running streak are revealed together. The accounts grow from their centre as their ribbon arrives.

The tooltip on the ribbon

The tooltip's point sits at a fraction u of the ribbon's width: the Bézier's x is inverted with a bisection to find t, and t gives the centre's y. The glass chases the point on a spring integrated by hand (stiffness 230, damping 23), and a white tick crosses the ribbon right there.

The month and the figures

Switching between Oct and Sep is a single number going from 0 to 1 with a back.out: every value is interpolated and the whole layout recomputed, so the ribbons pass the mark and come back. The figures at the top are columns of 0 to 9 sliding with yPercent, one after another.

Values to change

NameFileDefaultWhat it changes
RIBBONscript.js0.34How strong the ribbons are at rest, from 0 to 1.
DIMscript.js0.3How much of the other ribbons stays when one is chosen.
CURVEscript.js0.5How the ribbons bend: 0.3 steep in the middle, 0.65 long and soft.
GAPscript.js10Pixels between two accounts in the same column.
FLOW_SPEEDscript.js40How fast the light runs along the ribbons, in pixels per second.
FLOW_LIGHTscript.js0.5How bright that light is.
DRAWscript.js1Seconds each ribbon takes to draw itself.
SPRINGscript.js1How springy the press and the month switch are: 0.4 calm, 2 bouncy.
LOOPscript.jstrueWalks through the diagram by itself again and again.

Try them in the Playground

When to use it

For the dashboard of a banking or budgeting app, the monthly summary of a personal finance tool, the page of a fintech that wants to show where the money goes: income, accounts and spending at a glance, with the detail on touch.

On phones

The same animation with adapted sizes: the card is as wide as the box, the diagram is at most 46% of the screen tall and redraws to its size, the label columns narrow. A finger touches a ribbon or an account and the tooltip follows it.

With reduced motion

Nothing moves: the diagram fades in already drawn, the ribbons light up and dim with a fade, the tooltip appears still beside its point, the month switch swaps the ribbons with a fade and the figures change in place.

Pitfalls

  • Drawing a ribbon as a stroke as wide as the flow is handy but wrong: where the curve climbs the stroke, perpendicular to the curve, gets thinner. The ribbon is a closed path with two edges, and to make it draw itself it needs a clipPath, not a dash.
  • A callback at time zero at the start of a timeline may not fire when it is played from zero: the drawing sits at 0.01 s.
  • Mona Sans tabular figures look like another typeface next to the text: the rolling columns are already as wide as the widest digit, so tabular-nums is not needed.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 12 KB; the libraries: GSAP 28 KB.

Testing

Tested on 2 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations