Skip to content
animorio
IT
All components

API rate limit meter

Counters, HoverGSAP, CSS onlyMediumCompressed weight: Demo 4.8 KBGSAP 28 KBFreeDownload the zip

An API’s rate limit as a twenty-segment meter. Each burst empties some while the big number drops, and time refills them one at a time. When there are not enough requests left the status turns “429 Too many”, the card shakes and tints red, and the button counts the seconds until a retry; then the segments fill again in a wave.

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>
<!--
  "API rate limit meter" 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>API rate limit meter</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- an API's rate limit as a meter: every burst empties segments, time refills them one by one, and when
         they run out the status turns 429 and a short wait counts down before everything fills again -->
    <section class="rl" data-rl aria-label="API rate limit">
      <header class="rl__head">
        <div>
          <h2>Rate limit</h2>
          <p><span data-limit></span> requests per minute</p>
        </div>
        <span class="rl__status" data-statusbox><b data-status>200 OK</b></span>
      </header>
      <div class="rl__big"><b data-left></b><span>left</span></div>
      <div class="rl__meter" data-meter role="meter" aria-label="Requests left" aria-valuemin="0"></div>
      <button class="rl__send" type="button" data-send><span data-sendlabel></span></button>
      <span class="rl__say" data-say aria-live="polite"></span>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></path></svg>
  </main>

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

16 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “API rate limit meter” 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 black, a dark card: “Rate limit”, “60 requests per minute” and top right a teal pill, “200 OK”. Below, a large number, “60 left”, a row of twenty green segments and the pale button “Send 18 requests”. On opening the segments fill from the left. At each press the button gives, the number drops by eighteen and the segments on the right go out as they sink; meanwhile, slowly, time lights them one at a time and the number climbs back. At the fourth burst there are not enough requests: the number goes to zero, the card jolts, the shadow and the segments tint red, the pill rolls into “429 Too many” and the button dims and counts “Retry in 3s”, 2, 1. When the wait ends the pill is back to “200 OK” and the segments all fill in a wave. Pressed during the wait, the button just shakes its head.

How it works

True and shown

One number holds the requests really left, another what is displayed: at each burst the second chases the first on a tween, and segments and figure are drawn from it.

The segments

Each segment is worth three requests: its opacity and height are the share of that value still available, so the last one goes out halfway.

The refill

GSAP’s ticker adds, every frame, the requests earned in the time elapsed (REFILL per second), stopping at the limit and during the wait.

The 429

If there are not enough requests it goes to zero, a class changes one colour variable for card, pill and segments, and a linear tween counts the LOCK seconds before reopening.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#5eead4The colour of the full segments and the 200 status.
LIMITscript.js60How many requests per minute the limit allows.
BURSTscript.js18How many requests the button sends at each press.
REFILLscript.js1.5How many requests become available again each second.
LOCKscript.js3How many seconds to wait after a 429 before retrying.
LOOPscript.jstrueLeft alone, the demo’s pointer sends bursts until the 429 arrives and then waits.

Try them in the Playground

When to use it

In an API’s dashboard, in the docs to explain the limit, on a plan’s usage page: wherever a quota is spent in bursts and refills with time.

On phones

The same card, 304 pixels wide at most: the twenty segments share whatever width there is, the number stays large and the button is 44 pixels tall.

With reduced motion

Segments and number change at once at each burst, with no jolt and no wave; the pill and the button change their words without rolling and the seconds still count. The demo does not move by itself.

Pitfalls

  • The numbers are made up and nothing is really sent: in a real API the limit and the wait come from the response headers (Retry-After, for example), not from a count kept in the browser.
  • The meter has role meter with aria-valuenow updated only when the whole number changes, and an aria-live region tells the bursts, the 429 and the reopening.
  • Red is not the only signal: the “429 Too many” pill, the zero and the button’s words say it too.
  • During the wait the button has aria-disabled, not disabled: it stays reachable and explains why it will not send.
  • The refill uses the time elapsed between two frames: with the tab in the background the ticker slows down and the refill with it.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 4.8 KB; the libraries: GSAP 28 KB.

Testing

Tested on 22 November 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 components