Skip to content
animorio
IT
Back to the library

Rolling stats counter

Scroll, TextGSAP, CSS onlyMediumCompressed weight: Demo 9.5 KBGSAP + ScrollTrigger 45 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

The numbers section of a made-up tool for teams, Ferrow, in the clean style of product interfaces: the stage stays put and holds one big number only. First it counts up to 12,400 teams, then as you scroll it rolls from one stat to the next like an odometer, digit by digit from the right: the columns it no longer needs close, new ones open, the comma and the point slide into place, the word beside it rolls, the thin line underneath pulls back and draws itself again, and the rating brings five stars that fill up.

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>
<!--
  "Rolling stats counter" 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>Ferrow in numbers</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>
  <!-- the numbers section of a made-up planning tool, Ferrow. The stage sticks while you scroll and holds one big
       number only: it counts up to the first stat, then rolls from one stat to the next like an odometer, digit by
       digit from the right, while columns open and close, the comma and the point slide to their new places, the unit
       word rolls, the thin line under it redraws and the grey label changes. The rating brings five drawn stars. -->
  <main>
    <section class="corsa" data-corsa>
      <div class="palco" data-palco>
        <header class="testa">
          <p class="testa__nota">Ferrow in numbers</p>
          <h1 class="testa__titolo">Trusted by teams <span>in every time zone</span></h1>
        </header>

        <div class="dato" data-dato>
          <div class="misura" data-misura>
            <div class="numero" data-numero aria-hidden="true">
              <span class="numero__cifre" data-cifre></span>
              <span class="numero__unita" data-unita></span>
            </div>
            <span class="filo"><span class="filo__pieno" data-filo></span></span>
          </div>
          <p class="riga riga--etichetta" data-etichetta aria-hidden="true"></p>
          <div class="riga riga--nota" aria-hidden="true">
            <span class="stelle" data-stelle>
              <svg viewBox="0 0 92 16" data-stelle-svg>
                <defs>
                  <clipPath id="pieno-stelle"><rect data-riempi x="0" y="0" width="0" height="16" /></clipPath>
                </defs>
                <g class="stelle__contorni" data-contorni></g>
                <g class="stelle__piene" data-piene clip-path="url(#pieno-stelle)"></g>
              </svg>
            </span>
            <span class="riga__testo" data-nota></span>
          </div>
          <p class="voce" aria-live="polite" data-voce></p>
        </div>

        <div class="schede" role="tablist" aria-label="Ferrow stats" data-schede>
          <span class="schede__pillola" data-pillola aria-hidden="true"></span>
        </div>
      </div>
    </section>

    <footer class="piede">
      <p>Figures as of October 2026. Uptime measured across all regions.</p>
    </footer>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/ScrollTrigger.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/lenis@1.3.26/dist/lenis.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.

42 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 “Rolling stats counter” 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 warm white background sits the numbers section of Ferrow, a made-up tool for planning team work: at the top a blue line and the headline “Trusted by teams in every time zone”, in the middle one big number only, in Mona Sans, with its word beside it, a thin line underneath, a black label and a grey note; at the bottom four tabs, Teams, Uptime, Countries and Rating, with a white pill on the active one. At first there is a single digit, a 0, which counts up to 12,400: the columns open one after the other and the right-hand digits make one extra turn, as on an odometer. As you scroll the stage stays put and the number moves on to 99.98% uptime, 38 countries and 4.9 average rating without ever disappearing: every digit always rolls in the direction of the scroll, forward going down and backward going up, starting from the right and landing with a hair of bounce; the columns no longer needed close on the left while the decimals open on the right, the point, the comma and the % slide into place, and every column takes the width of its own digit, so the 1 stays narrow and the 0 wide. Meanwhile the word beside it rolls and changes width, the thin line pulls back to the right and draws itself again from the left with its blue tip, the label and the note rise into place, and the pill runs to the new tab with its front edge arriving first. For the rating five stars drawn as strokes come in and fill with gold up to 4.9, each with a small knock. Tapping a tab takes the scroll to its stat.

How it works

One wheel per digit

Every digit is a column one line tall with hidden overflow, holding a strip of thirty digits, 0 to 9 three times. The wheel’s position is a number that grows without end: the strip shows its part between 10 and 20 (pos modulo 10 plus 10), so a wheel can make as many turns as it likes, forward or backward, without ever reaching the end of the strip and without jumps, because the three copies are identical.

Places counted from the point

The number is read in places: p for what comes before, i0, i1, i2 for the whole digits counted from the point leftwards, f for the point and the decimals, s for what comes after, like the %. Going from 12,400 to 99.98% the wheels i0 and i1 stay and turn, i2, i3 (the comma), i4 and i5 leave, f0, f1, f2 and s0 come in: whatever leaves keeps its place until it has closed, sorted with the others, so the comma closes where it was.

The direction and the extra turn

Every wheel always turns in the direction of the scroll: the step is the distance forward (or backward) to the new digit, plus ten for each extra turn. The two right-hand wheels make TURNS extra turns, the next ones one fewer, and the first time, when the number counts up from 0, one more for all of them. They start from the right with RIPPLE seconds between them and land with back.out, a hair past and back.

As wide as their digit

Mona Sans draws its tabular figures like a typewriter, with a slashed zero: the wheels use the normal figures and every column takes the width of its own digit, measured once in ems when the font is ready. While the wheel turns the width moves from the old one to the new one in a separate tween, and whatever comes in or leaves multiplies it by a factor from 0 to 1: all in ems, so it is right at every screen size.

Line, words, stars and pill

The line is a child scaled with scaleX: it pulls back with its origin on the right and draws again from the left. The words roll inside a window one line tall, with the width going from the old one to the new one. The stars are outlines with pathLength 1 plus a filled copy cut by a clipPath that widens to 4.9. The pill has its two edges animated separately: the front one on a spring, the back one a moment later, so it stretches as it runs.

Values to change

NameFileDefaultWhat it changes
STATSscript.js[{ tab: "Teams", value: "12,400", unit: "teams", … }, …]The stats, one per tab: the tab name, the number with commas, point and % as they should read, the word beside it, the label, the note and the stars (0 for no stars).
RIDEscript.js1How much scroll it takes to go through all the stats: 2 is twice as long.
ROLLscript.js0.9How long a digit takes to roll, in seconds.
TURNSscript.js1How many extra turns the right-hand digits make before they settle, as on an odometer.
RIPPLEscript.js0.05The delay between a digit and the one to its left, in seconds.
BOUNCEscript.js1.5How far a digit overshoots its place before settling (0 = none).
--accentostyle.css#2f5bffThe colour of the line over the headline, of the tip of the thin line and of the focus ring.
--stellastyle.css#f2b01eThe colour of the filled stars.

Try them in the Playground

When to use it

For the numbers section of the landing page of a SaaS, an app or a service, when there are a few strong figures: one number at a time, large, read while scrolling, instead of four small numbers in a row. It also works for an annual report or an about page.

On phones

The same animation with adapted sizes: the number is sized on both width and height and fits the box even at 12,400 with its word, the tabs stay on one row at the bottom and the headline goes on two lines.

With reduced motion

The number changes without wheels: it appears already at its value with a fade, the words and the stars fade in, the line is already drawn and the pill jumps to the new tab without running.

Pitfalls

  • Mona Sans’s tabular figures (font-variant-numeric: tabular-nums) have a slashed zero and a footed one: the number looked typewritten. The normal figures are used and every column takes the width of its own digit.
  • The column widths are in ems, not pixels: the number is sized with clamp and changes on resize, pixels computed at the start would no longer match.
  • A single 0 to 9 strip is not enough to always turn the same way: with the tripled strip and the position taken modulo 10 a wheel can make full turns without jumps.
  • The digits that are leaving have to be put back in order together with the new ones on every change: appending only the new ones, a comma that was closing ended up at the end of the number.
  • The word beside the number sat lower than the digits (columns with hidden overflow have no baseline): the bottom margin is computed from the number’s size, calc(var(--n) * 0.105 - 0.2em).
  • Never once: true on a timeline with ScrollTrigger: here the ScrollTrigger has no timeline and only picks the stat, the tweens run on their own.

Libraries

GSAP 3.15.0, ScrollTrigger 3.15.0, Lenis 1.3.26, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 9.5 KB; the libraries: GSAP + ScrollTrigger 45 KB, Lenis 5.3 KB.

Testing

Tested on 27 October 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