Skip to content
animorio
IT
All components

Refresh data button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.4 KBGSAP 28 KBFreeDownload the zip

The Refresh button in the header of a made-up analytics app's dashboard, Corvel, light on white: pressed it gives by a pixel, the circular arrow takes a kick and then spins at a steady speed while the pill widens into Syncing 3 sources; beside it the dashboard's three values dim and light up again one by one with a soft flash, the digits rolling and the sparkline growing. Once loading is done the arrow brakes, overshoots a few degrees and settles, then turns into a clock with its hands, and the pill says Updated just now, then Updated 1m ago with the digit rolling.

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>
<!--
  "Refresh data button" 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>The Refresh button with the arrow that stops on the clock</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the Refresh button in the header of a made-up analytics dashboard, Corvel: pressed, the arrow spins with a kick,
         runs steady while three sources sync, brakes, settles and turns into a clock; the pill says Syncing 3 sources,
         then Updated just now, then Updated 1m ago with the digit rolling. Three values beside it flash as fresh data lands -->
    <div class="wrap" data-wrap>

      <div class="tiles" role="group" aria-label="Corvel overview">
        <div class="tile" data-tile>
          <span class="tile__flash" data-flash aria-hidden="true"></span>
          <span class="tile__label">Revenue</span>
          <span class="tile__value" data-value></span>
          <span class="tile__foot">
            <span class="tile__delta" data-delta></span>
            <svg class="spark" viewBox="0 0 40 16" aria-hidden="true"><path class="spark__fill" data-fill></path><path class="spark__line" data-line></path></svg>
          </span>
        </div>
        <div class="tile" data-tile>
          <span class="tile__flash" data-flash aria-hidden="true"></span>
          <span class="tile__label">Sessions</span>
          <span class="tile__value" data-value></span>
          <span class="tile__foot">
            <span class="tile__delta" data-delta></span>
            <svg class="spark" viewBox="0 0 40 16" aria-hidden="true"><path class="spark__fill" data-fill></path><path class="spark__line" data-line></path></svg>
          </span>
        </div>
        <div class="tile" data-tile>
          <span class="tile__flash" data-flash aria-hidden="true"></span>
          <span class="tile__label">Conversion</span>
          <span class="tile__value" data-value></span>
          <span class="tile__foot">
            <span class="tile__delta" data-delta></span>
            <svg class="spark" viewBox="0 0 40 16" aria-hidden="true"><path class="spark__fill" data-fill></path><path class="spark__line" data-line></path></svg>
          </span>
        </div>
      </div>

      <div class="slot">
        <button class="refresh" type="button" data-refresh data-autoclic aria-label="Refresh the Corvel dashboard">
          <span class="refresh__halo" data-halo aria-hidden="true"></span>
          <span class="refresh__sheen" aria-hidden="true"></span>
          <span class="refresh__in">
            <svg class="ic" viewBox="0 0 24 24" aria-hidden="true">
              <g data-spin>
                <circle class="ic__arc" data-arc cx="12" cy="12" r="7.5"></circle>
                <path class="ic__head" data-head d="M11.6 6.1 14.6 5 13 2.2"></path>
              </g>
              <line class="ic__hand" data-hour x1="12" y1="12" x2="12" y2="8.6"></line>
              <line class="ic__hand" data-minute x1="12" y1="12" x2="12" y2="6.8"></line>
            </svg>
            <span class="lab" data-lab></span>
          </span>
        </button>
      </div>
      <span class="measure" data-measure aria-hidden="true"></span>
      <p class="sr" data-live aria-live="polite"></p>
    </div>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></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.

18 values to change

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 “Refresh data button” 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 a white background there is the strip at the top of a dashboard: on the left three light tiles with a one pixel edge and a soft shadow, Revenue, Sessions and Conversion, each with its value, the green change with its arrowhead and a small blue violet sparkline with a fill below; on the right the Refresh button, a white pill sixty pixels tall, with light on its top half, a thin edge and three stacked shadows. On hover the pill lifts by a pixel, the shadow lengthens and the circular arrow winds up by turning back a few degrees; pressed, it gives by a pixel and squeezes slightly. On click the arrow takes a kick, speeds up and then calms to a steady speed, while the word leaves upwards and Syncing 3 sources comes in from below with a light running through it and the pill widens on a spring. The three values dim. Then, one at a time, the new data lands: a blue light crosses the tile and its edge lights up, the digits roll like an odometer starting from the last, the value lifts by a pixel and settles, the sparkline grows into its new shape and the change rolls over. Once they have all landed, the arrow brakes from the speed it had, overshoots by a few degrees and comes back with a settle. Its head folds away, the arc closes into a blue ring, the short hand comes in and the long one arrives turning on a spring: it is a clock. The pill gives a jolt, a thin halo spreads from its edge and the label becomes Updated just now. A few seconds later it rolls into Updated 1m ago, with the digit rolling from zero to one; then the hands leave, the ring opens back into the arrow and Refresh returns. A drawn pointer shows the loop on its own.

How it works

An arrow with its own speed

The arrow’s rotation is not a tween: it is an angle a GSAP ticker moves forward by speed times time. On click a tween takes the speed to KICK in a flash and then back to SPEED, so the arrow gets its kick and then spins steady while the sources load.

Braking without a jolt

To stop it the ticker lets go and the angle is taken, with power2.out, to the current one plus speed times BRAKE over two: power2.out starts at twice its average slope, so the arrow leaves at exactly the speed it had. Seven degrees too far, then an elastic.out brings it back: the settle.

From arrow to clock

The arc is a circle with the full circumference as strokeDasharray and a strokeDashoffset that shows 290 degrees of it; the head is a separate path. The head folds away with scale around its tip, the offset goes to zero and the ring closes, the hands grow from svgOrigin 12 12, the long one turning on a spring. With the ring closed the angle goes back to zero unseen.

Rolling digits

Each digit is a 0 to 9 column inside a one line window, moved by yPercent, ten per digit; symbols stay still. When the data lands the columns go to the new digit with back.out, from the last to the first, and the sparkline interpolates its seven points towards the new ones, redrawing the path.

A pill measured on its words

The labels sit on top of each other inside a window; the old one leaves upwards, the new one comes in from below with back.out and the pill’s width is measured on the real sentence in a hidden span with the same typeface, again once the typeface arrives.

Values to change

NameFileDefaultWhat it changes
LABELscript.jsRefreshThe label of the button at rest.
SOURCESscript.js3How many sources sync, written in the pill.
ACCENTscript.js#4b5cf0The colour of the fresh data light, the clock and the sparklines.
KICKscript.js1500The arrow’s kick on click, in degrees per second.
SPEEDscript.js540The arrow’s steady speed while loading, in degrees per second.
SYNCscript.js2.4How many seconds loading lasts.
BRAKEscript.js0.9How many seconds the arrow takes to stop.
AGOscript.js2.6After how many seconds Updated just now becomes Updated 1m ago.

Try them in the Playground

When to use it

In the header of an analytics dashboard, an admin panel, a CRM or a back office, next to the numbers the button refreshes: wherever people need to know the data has just landed and how old it is.

On phones

Below 640 pixels the three tiles sit in a row on top and the button below, in the middle, widening both ways; the values get slightly smaller and below 360 pixels the sparklines go. A finger presses like the mouse; without hover the arrow does not wind back.

With reduced motion

No spinning, springs, travelling flashes or rolling digits: the arrow stays still, the labels change with a fade, the new values appear in place with a flash that fades in and out, and the clock closes in a moment.

Pitfalls

  • Braking with a plain tween started slower or faster than the arrow and the jolt showed: the braking distance is speed times BRAKE over two, because power2.out starts at twice its average speed.
  • Hovering just before the click left a tween on the angle fighting the ticker: on click every tween on the arrow is killed.
  • Stopping the arrow on a multiple of 360 degrees made the braking a different length every time: it stops wherever it lands, and the angle goes back to zero while the ring is closed and the head hidden, so it does not show.
  • The pill’s width is measured on the sentence in a hidden span and again once Mona Sans arrives: with the fallback typeface Syncing 3 sources ran past the edge.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 13 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