Skip to content
animorio
IT
Back to the library

Net worth breakdown

Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 6.5 KBGSAP 28 KBFreeDownload the zip

The net worth of a personal finance app on a light card: the large figure, a bar with what you own on top in three shades of blue, what you owe below it in dark and the hatched rest that is the net, and the five lines as a list. Hovering a line lifts its stretch, the others fade and the figure counts to its value with its share; “A year ago” resizes the whole bar and recounts the figures.

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>
<!--
  "Net worth breakdown" 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>Net worth breakdown</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">
    <!-- the net worth of a personal finance app: one bar split between what you own and what you owe,
         the lines lifting their stretch on hover while the figure rolls, and the date resizing it all -->
    <article class="nw" data-nw aria-label="Net worth">
      <header class="nw__head">
        <span class="nw__lab"><span data-outlab>Net worth</span></span>
        <div class="nw__when" role="tablist" aria-label="Date" data-when>
          <i class="nw__pill" data-pill aria-hidden="true"></i>
          <button type="button" role="tab" aria-selected="true" data-day="now">Today</button>
          <button type="button" role="tab" aria-selected="false" data-day="then" tabindex="-1">A year ago</button>
        </div>
      </header>
      <div class="nw__sum"><strong data-outsum>$184,320</strong><span class="nw__chip"><span data-outchip>+$48,570 this year</span></span></div>
      <div class="nw__bar" data-bar>
        <svg data-svg aria-hidden="true">
          <defs><pattern id="nw-hatch" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="6" height="6" fill="var(--hatch-bg)"></rect><rect width="2.200" height="6" fill="var(--hatch)"></rect></pattern></defs>
          <rect class="nw__seg" data-seg="0" rx="5"></rect><rect class="nw__seg" data-seg="1" rx="5"></rect><rect class="nw__seg" data-seg="2" rx="5"></rect>
          <rect class="nw__seg" data-seg="3" rx="4"></rect><rect class="nw__seg" data-seg="4" rx="4"></rect>
          <rect class="nw__net" data-net rx="4" fill="url(#nw-hatch)"></rect>
        </svg>
      </div>
      <ul class="nw__rows" data-rows>
        <li><button type="button" data-row="0"><span>Cash</span><b data-outv>$18,400</b></button></li>
        <li><button type="button" data-row="1"><span>Investments</span><b data-outv>$96,250</b></button></li>
        <li><button type="button" data-row="2"><span>Home</span><b data-outv>$310,000</b></button></li>
        <li><button type="button" data-row="3"><span>Mortgage</span><b data-outv>−$228,900</b></button></li>
        <li><button type="button" data-row="4"><span>Credit card</span><b data-outv>−$11,430</b></button></li>
      </ul>
    </article>
    <span class="live" aria-live="polite" data-live></span>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></path></svg>
  </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.

27 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Net worth breakdown” 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 light warm ground, a rounded white card. At the top “Net worth” and on the right the “Today / A year ago” selector with its white pill; below, the large figure “$184,320” and the label “+$48,570 this year”. Then the bar: on top three stretches in three shades of blue (cash, investments, home), below it, on the same scale, two dark stretches (mortgage and card) and the rest filled with diagonal lines, which is the net worth. At the bottom the five lines with their amounts, debts with a minus. On entering the bar grows from the left and the figure counts from zero. Hovering a line (or its stretch) tints the row slightly, lifts the stretch a few pixels with a small bounce, fades the others, counts the large figure to that amount and the text above says “Investments”, with its share in the label beside it: “23% of what you own”. Leaving takes everything back to the net. “A year ago” springs the pill across, every stretch changes width one after the other, the amounts in the list and the large figure recount and the label says how much less it was.

How it works

A single scale

The bar’s width stands for everything you own. Debts sit below on the same scale, starting from the left: what is left uncovered is the net, visible without doing sums.

The bar is rewritten from the numbers

The six svg rectangles have no sizes in the markup: on every frame position, width and opacity are recomputed from the five animated values. Changing the date means animating five numbers.

The stretch that lifts

Every line has a number between zero and one: it moves its rectangle up (or down for debts) and takes opacity off the others. Row and stretch call the same function, so it works from the list and from the bar.

The figure follows

The large figure has one target at a time: the net, or the amount of the line pointed at. Every change makes it count there, and the label beside it gives the share worked out from the data.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#2f6bffThe colour of what you own (the three shades come from it).
GLIDEscript.js0.8How many seconds bar and figures take to go from one date to the other.
LIFTscript.js4By how many pixels the stretch of the hovered line lifts.
HOLDscript.js1.6How many seconds the demo’s pointer stays on each line.
LOOPscript.jstrueLeft alone, the demo’s pointer goes over the lines and changes the date.

Try them in the Playground

When to use it

On the main screen of a personal finance app, a bank or an adviser, where you want to say at a glance how much is owned, how much is owed and what is left; the same two-level bar carries a month’s income and spending, the budget spent and what remains, the used and free space of a storage plan.

On phones

The card is at most 344 pixels wide and about 330 tall, and narrows with the screen: the bar is recomputed on the new width and below 350 pixels the figure gets smaller. With a finger a line is tapped to hold it and tapped again to go back to the net.

With reduced motion

No growing bar and no stretches lifting on springs: the line pointed at is highlighted at once, the figure and texts change without counting or rolling, and on a date change the bar is already the new one, with a brief fade. The demo’s pointer does not start.

Pitfalls

  • The lines are real buttons, so Tab reaches them and the highlight follows focus; the two dates are tabs (a tablist) changed with the arrow keys, and an aria-live region says the net for the chosen date.
  • Debts are not told by colour alone: they sit on another level of the bar and carry a minus sign in the list (the real one, U+2212, written with String.fromCharCode).
  • The bar’s sizes are in pixels: they are recomputed on resize and once the fonts have finished loading, otherwise the date pill keeps the wrong width.
  • Lines, amounts and dates are invented; the comparison is with a single date, not a trend: that needs a line chart.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 29 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