Skip to content
animorio
IT
All components

Regenerate button

Buttons, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 9.6 KBGSAP 28 KBFreeDownload the zip

The Regenerate button under an invented AI assistant’s answer, on black: a graphite pill with the circular arrow. On hover the arrow winds up by a quarter turn; pressed, it makes a full turn and keeps spinning while a liquid metal trail, chrome with a cool blue glint, runs along the pill’s edge and the label becomes Regenerating. Then the arrow stops with a small settle, the trail gathers into a drop of light and the 2 / 2 version counter opens beside it, with the arrows to browse the versions.

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>
<!--
  "Regenerate 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 Regenerate button with the liquid metal trail on its edge</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" data-stage>
    <!-- the Regenerate button under an AI assistant's answer: a liquid metal light runs
         round the pill while the arrow spins, then the version counter opens beside it -->
    <div class="fit" data-fit>
      <div class="row" data-row>
        <button class="btn" type="button" data-btn data-autoclic aria-label="Regenerate Mira’s answer">
          <span class="btn__sheen" aria-hidden="true"></span>

          <svg class="trail" data-trail aria-hidden="true">
            <defs>
              <linearGradient id="cromo" data-chrome gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="200" y2="60">
                <stop offset="0" stop-color="#ffffff"/>
                <stop offset="0.16" stop-color="#9aa3b5"/>
                <stop offset="0.3" stop-color="#2b303b"/>
                <stop offset="0.44" style="stop-color: var(--accento-chiaro)"/>
                <stop offset="0.58" stop-color="#ffffff"/>
                <stop offset="0.72" stop-color="#5f6778"/>
                <stop offset="0.86" stop-color="#e9edf7"/>
                <stop offset="1" stop-color="#7c8496"/>
              </linearGradient>
              <filter id="liquido" x="-10%" y="-40%" width="120%" height="180%">
                <feTurbulence type="fractalNoise" baseFrequency="0.035 0.055" numOctaves="1" seed="7" result="n"/>
                <feDisplacementMap in="SourceGraphic" in2="n" scale="2.2" xChannelSelector="R" yChannelSelector="G"/>
              </filter>
              <filter id="alone" x="-20%" y="-60%" width="140%" height="220%">
                <feGaussianBlur stdDeviation="3.2"/>
              </filter>
            </defs>
            <path class="trail__rim" data-rim d=""/>
            <g class="trail__glow" filter="url(#alone)" data-glow></g>
            <g class="trail__metal" filter="url(#liquido)" data-metal></g>
            <circle class="trail__head" data-head r="2.2" cx="0" cy="0"/>
          </svg>

          <span class="btn__icon" aria-hidden="true">
            <svg class="arrow" data-arrow viewBox="0 0 24 24">
              <circle class="arrow__ring" data-ring cx="12" cy="12" r="7.25" pathLength="100"/>
              <path class="arrow__tip" data-tip d="M15.67 3.11 16.5 6.2 13.41 7.03"/>
            </svg>
          </span>

          <span class="btn__words">
            <span class="btn__stem">Regenerat</span><span class="btn__end" data-end><span class="btn__suf" data-suf-e>e</span><span class="btn__suf btn__suf--ing" data-suf-ing aria-hidden="true">ing</span></span>
          </span>

          <kbd class="btn__key" data-key aria-hidden="true">R</kbd>
        </button>

        <div class="versions" data-versions aria-label="Answer versions" role="group">
          <div class="versions__in" data-versions-in>
            <button class="versions__btn" type="button" data-prev aria-label="Previous version">
              <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.8 3.8 5.6 8l4.2 4.2"/></svg>
            </button>
            <span class="versions__count" aria-live="polite">
              <span class="roll" data-cur><span>1</span></span><span class="versions__sep">/</span><span class="roll" data-tot><span>1</span></span>
            </span>
            <button class="versions__btn" type="button" data-next aria-label="Next version">
              <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6.2 3.8 10.4 8l-4.2 4.2"/></svg>
            </button>
          </div>
        </div>
      </div>
    </div>
    <p class="sr" data-live aria-live="polite"></p>

    <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.

22 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 “Regenerate 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

In the middle, on black, a 60 pixel graphite pill with a thread of light on its top edge: the hand-drawn circular arrow, the Regenerate label and on the right the R key, the shortcut. It is the button under the answer of Mira, an invented AI assistant. On hover (or with the Tab key) the pill rises by a pixel, a cool glint lights up inside it and follows the pointer, the label widens a touch on the wdth axis and the arrow winds up by a quarter turn on a spring. Pressed, the pill sinks and springs back; the arrow starts, makes the full turn and keeps spinning, the ring shortens and lengthens like a loader and the tip pulls in. Meanwhile a liquid metal trail is born on the pill’s edge: a tapering chrome tail with sliding reflections, a rim that wobbles slightly like molten metal, a blue glow under it and a thicker white head; the light it carries is mirrored inside the graphite, where it passes. The label becomes Regenerating: Regenerat stays put, the e leaves upwards and ing comes in from below, and the pill widens on a spring. After two and a half seconds the arrow slows and stops on the full turn with a small settle, the tip snaps back, the trail chases its head to the top of the pill and gathers into a drop of light that fades, the pill hops by a pixel and the label goes back to Regenerate. Beside it the version counter opens, a small pill with two arrows: 1 / 1 rolls on to 2 / 2. The left arrow goes back to the previous version (the number rolls down), the right one goes forward; every new regenerate adds a version, up to five. A drawn pointer does the round by itself: it hovers, presses, waits, browses the versions and then everything starts again.

How it works

A path round the pill

The script measures the pill and writes a pill-shaped path that starts at the top centre and runs clockwise, with pathLength 1000: so every trail measure is given in thousandths of the edge, whatever the width. The path is only rewritten when the pill changes size, also halfway through the widening of Regenerating.

A tapering tail

SVG cannot fade a stroke along its length, so the trail is seven stacked dashes that all end at the head: the longest is thin and nearly transparent, the shortest thick and solid. Each has stroke-dasharray L and 1000 minus L, and stroke-dashoffset L minus the head position, which, with the period equal to the edge, wraps round with no jump.

The liquid metal

The strokes use a chrome linearGradient (white, steel grey, near black, a blue glint) that rotates with the head, so the reflections slide along the trail; a feDisplacementMap with a still noise makes the rim wobble as the trail passes over different parts of the noise. Underneath, three wider strokes with a feGaussianBlur make the glow, and the head position (getPointAtLength) lights the glint inside the graphite.

One speed

The arrow and the trail head read the same speed f, which GSAP takes from 0 to 1 with power2.in on press: they start together and spin together in the ticker, with the step capped at a thirtieth of a second. To stop, f goes back to zero and the arrow moves on to the next full turn with elastic.out, while the head reaches the top and the tail shortens until it gathers into a point that flares and fades.

The label and the counter

Regenerat is fixed; the ending sits in a one-line window with e and ing stacked, and the window width goes from one to the other with back.out, so the pill widens by itself. The counter opens from zero width to its natural size; each number rolls in its own window, up going forward and down going back.

Values to change

NameFileDefaultWhat it changes
BUSYscript.js2.6Seconds the answer takes to regenerate: the arrow spins and the trail runs along the edge.
LAPscript.js1.05Seconds for one lap of the trail round the pill.
SPINscript.js0.8Seconds for one turn of the arrow while it spins.
TRAILscript.js0.34Length of the trail, as a share of the edge.
WINDscript.js90Degrees the arrow winds up by on hover.
WOBBLEscript.js1.6How much the liquid metal wobbles on the edge (0 smooth).
MAX_VERSIONSscript.js5How many versions of the answer are kept.
PRESS_SCALEscript.js0.968How far the pressed button sinks.
ACCENTscript.js#9fb4ffThe accent colour: the cool glint in the metal and the glow.

Try them in the Playground

When to use it

Under the answer of an AI chat, in a text or image generator, in an app that rewrites emails or captions: the button to ask for another version, with the counter to go back to the earlier ones. Without the counter it suits any Retry or Refresh that takes a few seconds.

On phones

The same animation: if the row with the open counter does not fit the screen minus 24 pixels, the script scales it down just enough, recalculating on resize. A tap is the click; the hover quarter turn comes with focus.

With reduced motion

Nothing spins and nothing moves: the arrow stays still, instead of the trail the whole chrome edge fades in and fades out at the end, labels and numbers swap with a fade and the counter appears without a spring; the pilot’s pointer is hidden.

Pitfalls

  • A single stroke with a gradient along the trail is not possible in SVG: the gradient follows space, not the path. The tapering tail comes from seven stacked dashes ending at the same point.
  • With the path built only on load, the trail left the edge while the pill widened for Regenerating: now the size is checked every frame and the path is rewritten when it changes.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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