
The elastic button
Buttons, Hover, Text
A dashboard card with twelve weeks of signups split by channel, in stacked bars of three tones of the same blue. The bars grow from the bottom one after another, on hover the week lights up and the others fade while a tooltip follows softly with the three values and the total, digits rolling; the legend takes a channel out and puts it back and the bars resettle on a short spring.
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>
<!--
"Stacked bar chart" 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 stacked bar chart with a tooltip</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 card of an analytics dashboard: twelve weeks of signups stacked by channel. Hover a week and the column
lights up while a tooltip follows with the three values; the legend takes a channel out and puts it back -->
<section class="card" data-card aria-label="Signups by channel">
<header class="card__head">
<div>
<h1 class="card__title">Signups by channel</h1>
<p class="card__sub">Kestrin · last 12 weeks</p>
</div>
<button class="card__range" type="button" tabindex="-1" aria-hidden="true">
12 weeks
<svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 4.6 6 7.6l3-3"></path></svg>
</button>
</header>
<div class="total">
<p class="total__num" data-total aria-live="polite"></p>
<p class="total__delta" data-delta>
<svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 8.4 8.4 3M4.4 3h4v4"></path></svg>
<span data-delta-num>+12.4%</span>
</p>
<p class="total__vs">vs previous 12 weeks</p>
</div>
<div class="legend" data-legend role="group" aria-label="Channels"></div>
<div class="chart" data-chart>
<div class="chart__grid" aria-hidden="true">
<span></span><span></span><span></span><span></span>
</div>
<div class="chart__bars" data-bars></div>
<div class="tip" data-tip aria-hidden="true">
<p class="tip__week" data-tip-week></p>
<div class="tip__mix" data-tip-mix><i></i><i></i><i></i></div>
<div class="tip__rows" data-tip-rows></div>
<p class="tip__total"><span>Total</span><b data-tip-total></b></p>
</div>
</div>
<div class="axis" data-axis aria-hidden="true"></div>
</section>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></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>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.
23 values to change
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 “Stacked bar chart” from Animorio and fit it into my siteEach week is a flex column with column-reverse and three coloured i elements inside, one per channel: the first sits at the bottom. Heights are in pixels, the value times the chart’s scale, that is the usable height divided by the tallest visible week; the white hairline between segments is a two pixel margin that only exists between visible segments.
A timeline takes each segment from zero to its height in GROW seconds with back.out, staggering columns by STAGGER and the segments of one column by seven hundredths: the column grows from the bottom, one channel after another.
Every digit of the total and the tooltip is a column of ten numbers ten lines tall, shut in a window one line tall; GSAP moves it by yPercent minus ten per digit with power3.out, the units a moment before the tens. The commas stay still.
On hover the column is found from the pointer’s x; the tooltip goes to the right of the column, or to the left if there is no room, and two quickTo take it there in TIP_LAG seconds, so it glides instead of jumping. The other columns drop to DIM opacity.
A click on a pill flips the channel, recomputes every height and the scale and animates them with back.out starting from the nearest week; the last visible channel cannot be switched off and its pill gives a small no. The autopilot is a timeline with repeatRefresh, so the fake pointer’s positions are worked out again on every round.
| Name | File | Default | What it changes |
|---|---|---|---|
TITLE | script.js | Signups by channel | The card’s title. |
DELTA | script.js | +12.4% | The change next to the total. |
STAGGER | script.js | 0.045 | The delay between one bar and the next as they grow. |
GROW | script.js | 0.7 | The seconds a bar takes to grow. |
DIM | script.js | 0.38 | How visible the other weeks stay on hover. |
BOUNCE | script.js | 1.25 | How much the bars bounce as they resettle. |
TIP_LAG | script.js | 0.32 | How long the tooltip takes to catch the pointer, in seconds. |
For a SaaS product’s dashboard, the stats of an online shop or an app, a marketing panel: wherever a number has to be split into its parts and read week by week.
The card takes almost the full width, the chart is sized on the screen’s height and the vs previous 12 weeks line is hidden; a tap on a column does what hovering does and a tap outside closes the tooltip.
The bars are already at their height, without growing; the tooltip stays open on the last week, moves without gliding and the digits change without rolling; the legend changes the bars at once.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.8 KB; the libraries: GSAP 28 KB.
Tested on 25 October 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.