Skip to content
animorio
IT
All components

Stop generating button

Buttons, Hover, SVGGSAP, CSS onlyEasyCompressed weight: Demo 4.5 KBGSAP 28 KBFreeDownload the zip

One button, one sign, in the simple style of product interface pieces: the black «Stop generating» pill of an AI chat, with the stop square inside a thin ring that spins while the answer is being written. On tap the ring brakes, closes into a full circle, goes a hair past the top and settles; the square tips into the play triangle and «Continue» arrives. On a second tap the ring opens again from nothing and spins up.

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>
<!--
  "Stop generating 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 Stop generating button with the ring that brakes</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>
    <!-- one button, one sign: the ring that spins while the AI writes brakes, closes and the square turns into a play sign -->
    <button class="stop" type="button" data-stop aria-pressed="false" aria-label="Stop generating">
      <span class="stop__body" data-body>
        <svg class="stop__icon" viewBox="0 0 32 32" aria-hidden="true">
          <circle class="stop__track" cx="16" cy="16" r="12"/>
          <g data-spin>
            <circle class="stop__ring" data-ring cx="16" cy="16" r="12" transform="rotate(-90 16 16)"/>
          </g>
          <path class="stop__glyph" data-glyph d="M12.2 12.2 L19.8 12.2 L19.8 19.8 L12.2 19.8 Z"/>
        </svg>
        <span class="stop__label" aria-hidden="true">
          <span class="stop__word" data-word="on">Stop generating</span>
          <span class="stop__word" data-word="off">Continue</span>
        </span>
      </span>
    </button>
  </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.

14 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 “Stop generating 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 white, alone in the middle, there is a black pill reading «Stop generating» and, on its left, the small stop square inside a thin ring: an arc in the accent colour spins on a barely visible track, growing a little longer and shorter, as it does while the assistant writes. On tap the pill gives a little and comes back on a spring; the arc brakes, travels at least half a turn more as it slows down and stretches until it closes into a full circle, which lands a hair past the top and settles. The circle rests a beat, then fades into the track. The square tightens as if hit and tips into the play triangle, a pixel too far, then settles. Meanwhile «Stop generating» rises away and «Continue» arrives, coming in narrow and opening up on the width axis; the pill shortens on a spring. On a second tap the triangle turns back into the square, the arc is born again at the top and spins up, and «Stop generating» returns. Hovering brings the pill a touch closer and the sign grows by a hair. Until someone touches it, the pill plays the gesture by itself.

How it works

A ring made of two numbers

The arc is an SVG circle with stroke-dasharray: its length and the group’s rotation live in one object, and a single function redraws them. That way the same ring can spin, breathe, brake and close without the tweens stepping on each other.

The braking

On tap the two endless tweens (the turn and the breath) stop and the rotation goes to the first multiple of 360 degrees at least 200 degrees away, plus six, with power3.out: it slows down like a wheel. Then it comes back six degrees with power2.inOut, the hair past and the settle; meanwhile the arc stretches into the full circle.

From square to triangle

The sign is a four-point path: the triangle repeats its tip point, so GSAP interpolates the d attribute number by number. With back.out the triangle goes a pixel too far and comes back; a rounded stroke in the same colour softens the corners of both.

The restart

On the second tap the arc starts again from zero length at the top, and the turn’s timeScale goes from 0 to 1 with power2.in: the ring speeds up instead of starting at full speed.

The word coming in narrow

The old word rises and leaves before the new one arrives, which comes up from below with the wdth axis at 75 and the weight at 420 and lands at 100 and 560 with back.out. The pill’s width follows the new word, measured in its final shape.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#7b6cffThe colour of the spinning ring.
LABEL_ONscript.jsStop generatingThe word while the answer is being written.
LABEL_OFFscript.jsContinueThe word once it has stopped.
TURNscript.js1.1How many seconds one turn of the ring takes.
SPRINGscript.js1How springy the press and the sign are: 0.4 calm, 2 very bouncy.
SPEEDscript.js1The speed of everything: 2 twice as fast, 0.5 half.
HOLDscript.js2.2How many seconds each state stays when the button plays by itself.
AUTOscript.jstrueThe button plays the gesture by itself until someone touches it.

Try them in the Playground

When to use it

For the button that stops an AI assistant’s answer, or any long job that can be interrupted and resumed: the braking ring says it has really stopped, the play sign says it can start again.

On phones

On the phone the pill and the icon take their size from the screen (clamp on the shorter side); there is no hover, everything else is the same.

With reduced motion

The ring stays still and fades out, the square and the triangle swap with a fade, and so do the words; the pill takes its new width at once.

Pitfalls

  • If the arc’s turn and breath both wrote to the attribute they would cancel each other out: they write to an object and a single function redraws the ring.
  • To brake on the top the rotation goes to a multiple of 360 degrees at least 200 away: with the nearest multiple the ring sometimes stopped dead after a few degrees.
  • A three-point path and a four-point path do not interpolate: the triangle repeats its tip, so it has the same numbers as the square.
  • «Stop generating» is much longer than «Continue»: a pill shrinking at once cut the old word on its way out. When the pill gets shorter it waits two tenths of a second, until the old word has gone.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 31 October 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