Build an Animated Number Counter and Progress Ring Stats Dashboard in HTML
You get a single HTML stats section where numbers ease up to their targets and SVG progress rings fill on scroll, with an editor panel and screen-reader announcements.
The prompt
Act as a senior front-end developer and motion designer. Build Harbor Light Solar Co-op, by the numbers: a stats section for a community solar co-op's 2024 impact report. It has four cards: Homes powered (1,284 of a 1,500 goal), Clean energy generated (3.6 GWh of 5), Member satisfaction (94% of 100) and CO₂ avoided (2,140 t of 2,500). Each card has an SVG progress ring with the number in its center, a label and a one-line note.
Rules:
1. When the stats scroll into view (IntersectionObserver), each number eases from 0 to its target over about 1.8 seconds with ease-out-cubic. Cards are staggered by 160 ms, and each ring fills in sync to target divided by goal.
2. Keep the target's decimal places (up to two), add thousands separators and append the suffix.
3. Below the cards, add an editor with Target, Goal and Suffix inputs for each stat, plus Apply and replay, Reset and Replay buttons. Enter applies and R replays. Show inline validation and use no form element.
4. Accessibility: hide the animating numbers with aria-hidden, give each card screen-reader text with the final value, and use a polite live region that announces all final values when the animation ends.
5. With prefers-reduced-motion, jump straight to the final values.
6. Use a warm off-white background, dark ink and one accent per ring (teal, amber, rose, indigo). Make the grid responsive from 360 to 1280 px, with visible focus rings and no external assets.
Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- One easing function and one rAF loop drive both the number text and the ring's stroke-dashoffset, so the count and the ring stay in sync.
- Taking decimals from the target string means values like 3.6 GWh animate cleanly without per-stat configuration.
- Animating digits are aria-hidden, while the card text and a live region give the final values, so screen readers avoid noise.
Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as stats.html and open it in any browser, or view it in the chat's preview or canvas. Then edit the targets in the panel to test your own figures.
Common edits
- Swap the four stats, notes and ring colors for your own brand figures, or change the duration and stagger values in the script.
- Add a subtle Web Audio tick when each counter finishes, with a mute toggle, or replace ease-out-cubic with a spring curve.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Build a Self-Drawing SVG Lighthouse Line Animation in One HTML File
You get a single HTML page where a hand-built SVG lighthouse draws itself stroke by stroke with staggered timing, then fades in its colors, with replay and speed controls.
Build an Animated Nonprofit Impact Stats Counter Section in One HTML File
Get a polished nonprofit impact section where six key figures count up with easing on scroll, with formatted thousands, percentages and currency plus believable captions.
Build an Animated SVG World Clock with Sweeping Hands and Five Time Zones
A single HTML file with a crisp SVG analog clock whose hands glide continuously and ease smoothly between five world cities, each with a labeled UTC offset.
Build a Button Micro-Interaction Showcase with Ripple, Magnetic Hover and Checkmark
You get one self-contained HTML page with three accessible button micro-interactions: ripple, magnetic hover and a success checkmark. Each card has a copyable standalone code snippet.
Build a CSS Cubic-Bezier Easing Curve Visualizer with Draggable Handles
A single HTML file with a draggable bezier curve editor that races test boxes against CSS built-in easings and gives you a ready-to-paste cubic-bezier value.
Build an Animated SVG Wave and Liquid Fill Background Generator
A single HTML file that generates layered, seamlessly looping SVG waves with live controls and exports ready-to-use animated SVG and CSS code.