Scrub Counter Ring
What it does
A huge figure counts from one value to another tied to the scroll (scrub 0.6) inside a sticky full-bleed photo, ringed by a hairline circle whose coloured arc draws at exactly the same pace. The count and the arc are ONE timeline on ONE ScrollTrigger, so the number and the ring can never disagree; tabular figures keep the digits from jittering, and from/to/decimals live in data attributes on the section.
How it's built
| Category | scroll |
|---|---|
| Tech | gsap |
| GSAP plugins | ScrollTrigger |
| Complexity | section |
| Performance cost | light |
| Mobile-safe | yes |
Rebuild it with AI
This component's prompt is part of the paid library. Below you can read how it starts; the full prompt, the exact structure, timing and easing an AI agent needs to rebuild the effect, unlocks with any paid plan, yearly or lifetime.
# Scrub Counter Ring — a huge figure counts with the scroll inside a ring that draws itself
## Goal
Build one tall section whose inner stage is sticky. Behind everything, a full-bleed photograph stays fixed for the whole run under a dark veil. In front of it, centred, a very large figure counts from `80.0` to `99.9%` as the user scrolls through the section, and a hairline circle surrounds the figure: a second circle on top of it, in the accent colour, draws itself clockwise from 12 o'clock **at exactly the pace of the count**, so when the number reaches `99.9` the ring has closed. The link to scroll is a short **lagged scrub** (`scrub: 0.6`): the last digits roll and settle a beat after the wheel stops instead of jumping in steps.
The single idea that makes this component work: **the count and the arc are one timeline driven by one ScrollTrigger.** Two separate triggers with identical settings look the same on day one and drift apart the first time somebody edits one `start` value; then the ring says 70 % while the number says 95, and the whole point of the piece is that they say the same thing.
## Tech
Vanilla HTML/CSS/JS with ES module imports. `gsap` (npm) plus the `ScrollTrigger` plugin, registered with `gsap.registerPlugin(ScrollTrigger)`. **No Lenis, no SplitText, no other library.** The component works the same under native scroll and under a host page's Lenis (see the last section).
Fonts, self-hosted (no Google Fonts request at runtime): **Bricolage Grotesque** (variable, opsz 12–96, weights 200–800) for the figure, **IBM Plex Mono** 400 for the microlabels, **Instrument Sans** 400 for the sentence. In this repo they are `/c/_vendor/fonts/css/bricolage-grotesque+ibm-plex-mono-e06e78da.css` and `/c/_vendor/fonts/css/instrument-sans-2a2bea16.css`; anywhere else, self-host the same three families.
## Layout / HTML
The whole component is one `<section>`. The numbers of the count live as data attributes on it, not in the script, because changing the figure is the first thing anyone reusing this does:
```html
<section class="ring" data-from="80" data-to="99.9" data-decimals="1">
<div class="ring__pin">
…
Premium prompt
Unlock this prompt, and every other one
From $99/year, or $139 once for lifetime access. Commercial license included.
See pricing Or start with the free set Already bought? Sign in
New components in your inbox
One email a week, only when new components ship, each with its live demo and prompt.