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

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

One HTML file. Save it and open it in any browser.Open full screen

Example: Harbor Light Solar Co-op, an animated impact stats dashboard.

Scroll the four stat cards into view and the numbers count up while their rings fill toward each goal. Use Replay animation or press R to run it again. In Edit the figures, change a target (try 3.75), goal or suffix, then press Enter or Apply and replay. Invalid values are highlighted, and screen readers hear the final totals.

Written by AI from this prompt. Your results will vary.

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 in Animations & Effects