01.16 · Scroll-Based
Counter Animation
Numbers count up when they scroll into view. Best for stats.
Scroll it
Scroll inside the box, or press Play and it scrolls for you.
Scroll down ↓
Inside, the dashed line is where counting starts; each tile's shade shows its count climbing over time, and a line sweeps across as the number counts. Scroll the box or press Play to watch.
Already there shows the totals from the start; Counts up climbs from zero once the tiles reach the dashed line, and rests half a second in. Scroll the box or press Play to watch.
Try it
Change a setting, then scroll again or press Play.
Starts counting
How far the numbers scroll into the box before counting.
Speed
How long the numbers take to reach their totals.
Feel
Springy goes a little past each total, then settles.
Copy the prompt
Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.
Add a count-up animation to [the numbers in your stats section]. When the numbers scroll far enough into view, count each one up from zero to its total, and format it on every step so commas, currency signs and units show the whole way through, not just at the end. Count again if the numbers leave the view and come back. When the settings include it, start each number a moment after the one before for a cascade. Screen readers should hear each final number once, never the steps in between. If the visitor has reduced motion turned on, show the final numbers straight away. Match the settings listed below.
Your settings
Replace the words in brackets with your own element. Your settings are added at the end.
Free and open source. If this helped, a star on GitHub helps other people find it.
Star on GitHubWhat it is
The full explanation is in README.md.