
The star rating
Ratings, SVG, Hover
The revenue card of a dashboard, clean on white: the total in tabular digits that roll like an odometer, the badge with the change and a violet line. Under the pointer a cursor snaps from day to day and the total rolls to that day; dragging across the chart picks a range, the line outside it turns grey, two handles appear to move it and the total rolls to the range's sum. 7D, 30D and 90D bend the line into the new period, with the white pill sliding under the choice.
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>
<!--
"Revenue range 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 revenue range chart</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 revenue card of a dashboard: the total in rolling tabular digits, the change against the previous period
and a line chart. Point at a day and the figure rolls to it; drag across the chart and the range lights up,
the figure rolls to the range's total and the badge to its change. 7D, 30D and 90D bend the line into
the new period -->
<article class="rev" data-rev>
<header class="rev__head">
<div class="rev__title">
<svg class="rev__icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 13.5h11 M4 11V8.5 M7 11V5.5 M10 11V7 M13 11V3.5"></path></svg>
<span data-metric>Revenue</span>
</div>
<div class="seg" role="tablist" aria-label="Period" data-seg>
<span class="seg__pill" data-pill aria-hidden="true"></span>
<button class="seg__btn" type="button" role="tab" data-range="0">7D</button>
<button class="seg__btn" type="button" role="tab" data-range="1">30D</button>
<button class="seg__btn" type="button" role="tab" data-range="2">90D</button>
</div>
</header>
<div class="rev__fig">
<div class="num" data-num aria-hidden="true"></div>
<span class="badge" data-badge>
<svg class="badge__arrow" data-arrow viewBox="0 0 12 12" aria-hidden="true"><path d="M6 9.5V2.8 M2.9 5.6 6 2.5l3.1 3.1"></path></svg>
<span class="badge__num" data-badge-num></span>
</span>
</div>
<div class="rev__subrow">
<p class="rev__sub" data-sub></p>
<button class="clear" type="button" data-clear aria-label="Clear the range" tabindex="-1">
<svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3.2 3.2l5.6 5.6 M8.8 3.2 3.2 8.8"></path></svg>
<span>Clear</span>
</button>
</div>
<div class="plot" data-plot tabindex="0" role="img" aria-label="Revenue chart. Arrow keys move along the days, Shift and the arrows select a range, Escape clears it.">
<svg class="plot__svg" data-svg aria-hidden="true">
<defs>
<linearGradient id="rev-fill" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="var(--accent)" stop-opacity=".22"></stop>
<stop offset="1" stop-color="var(--accent)" stop-opacity="0"></stop>
</linearGradient>
<linearGradient id="rev-fill-dim" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="var(--dim)" stop-opacity=".45"></stop>
<stop offset="1" stop-color="var(--dim)" stop-opacity="0"></stop>
</linearGradient>
<clipPath id="rev-clip"><rect data-clip x="0" y="-20" width="0" height="400"></rect></clipPath>
</defs>
<g data-grid></g>
<rect class="plot__band" data-band x="0" y="0" width="0" height="0" rx="6"></rect>
<path class="plot__area plot__area--dim" data-area-dim></path>
<path class="plot__line plot__line--dim" data-line-dim></path>
<g clip-path="url(#rev-clip)">
<path class="plot__area" data-area></path>
<path class="plot__line" data-line></path>
</g>
<g class="handle" data-handle="a"><line class="handle__bar" x1="0" x2="0"></line><rect class="handle__grip" x="-3.5" width="7" height="16" rx="3.5"></rect></g>
<g class="handle" data-handle="b"><line class="handle__bar" x1="0" x2="0"></line><rect class="handle__grip" x="-3.5" width="7" height="16" rx="3.5"></rect></g>
<g class="cursor" data-cursor>
<line class="cursor__line" x1="0" x2="0"></line>
<circle class="cursor__halo" r="9"></circle>
<circle class="cursor__dot" r="4"></circle>
</g>
</svg>
<div class="tip" data-tip><span data-tip-day></span><span class="tip__val" data-tip-val></span></div>
</div>
<div class="axis" data-axis aria-hidden="true"></div>
<p class="sr" aria-live="polite" data-live></p>
</article>
<svg class="fake" data-fake viewBox="0 0 20 24" aria-hidden="true"><path d="M3 2.2v17.4l4.6-4.4 3 6.6 2.9-1.3-3-6.5h6.3Z"></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.
25 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 “Revenue range chart” from Animorio and fit it into my siteThe total is a row of slots, one per character, lined up from the right. Every digit is a column from 0 to 9, ten lines tall, in a slot that shows one line: to change digit GSAP moves the column by -10% per unit, with back.out(1.15) and a delay of ROLL_STAGGER from the right. Extra slots come in widening from zero, the ones no longer needed shrink away on the left; the digits are tabular, so nothing jiggles.
Every period, 7, 30 or 90 days, is read with a Catmull-Rom curve at 180 points, normalised between its own lowest and highest. Changing period GSAP takes every point from one curve to the other in MORPH seconds and redraws the path on every frame: the line bends instead of vanishing.
The line is drawn twice, grey underneath and violet on top inside a clipPath. With no range the clip rectangle covers everything; dragging narrows it between the two handles, together with the tinted band, with short power3.out tweens. Near a handle the drag takes that handle instead of starting a new range; a tap without dragging clears it.
A GSAP timeline moves a pointer drawn in SVG and calls the same functions as the real pointer: it points, presses, drags, releases, presses Clear and the periods. The positions are functions read at the start of every stretch, so they follow the card even when it changes size. At the first real gesture the timeline stops, and starts again after IDLE quiet seconds.
The periods are tabs with aria-selected and the arrow keys; the chart takes focus: the arrows move the cursor, Shift and the arrows widen the range, Escape clears it, and an aria-live line reads out the total. With reduced motion the digits change with a fade, the line jumps to the new period without bending and there is no pretend pointer.
| Name | File | Default | What it changes |
|---|---|---|---|
METRIC | script.js | Revenue | The name of the figure, top left. |
CURRENCY | script.js | $ | The sign before the amounts. |
START | script.js | 1 | The period at the start: 0 is 7 days, 1 is 30, 2 is 90. |
MORPH | script.js | 0.8 | The seconds the line takes to bend into the new period. |
ROLL | script.js | 0.6 | The seconds a digit takes to roll to its new value. |
ROLL_STAGGER | script.js | 0.025 | The seconds between one digit and the next, from the right. |
CURSOR | script.js | 0.22 | The seconds the cursor takes to reach the day under the pointer. |
IDLE | script.js | 3.5 | The quiet seconds before the pointer that shows it comes back. |
For the main figure of a dashboard: an online shop's revenue, an app's subscriptions, a hotel's bookings, an event's ticket sales, anywhere a number needs to be read over time and two days or a range compared.
The card takes the screen's width minus 16 pixels a side, the total and the chart are measured on the height too, so everything fits in the box. With a finger: a tap shows the day, dragging sideways picks a range, dragging up or down scrolls the page as usual.
The digits change with a fade instead of rolling, the line jumps to the new period without bending, the pill and the range go to their places without sliding and there is no pretend pointer: only the periods change on their own.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 11 KB; the libraries: GSAP 28 KB.
Tested on 24 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.