
The elastic button
Buttons, Hover, Text
The Regenerate button under an invented AI assistant’s answer, on white: the circular arrow winds up and spins on a spring, a band of violet light runs across the answer and melts the words as it reaches them, the new version writes itself word by word while the card takes its height, and beside it the version counter opens and rolls from 1 / 2 to 2 / 2. The two small arrows go back to the previous version.
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 answer 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 that rewrites the answer with a sweep of light</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">
<!-- one gesture: press. An assistant's answer with its toolbar: Regenerate spins its arrow on a spring, a band of
light passes over the answer and melts the words, the new version writes itself word by word, the card
takes its new height, and the version pager appears and rolls from 1 / 2 to 2 / 2. The small arrows go back. -->
<article class="card" data-card aria-label="Assistant answer">
<span class="card__edge" data-edge aria-hidden="true"></span>
<p class="ask" data-ask>Suggest an opening line for our spring launch email.</p>
<header class="who">
<span class="who__mark" aria-hidden="true">
<svg viewBox="0 0 20 20"><path d="M10 2.6c.5 3.6 2.2 5.6 5.8 6.4-3.6.8-5.3 2.8-5.8 6.4-.5-3.6-2.2-5.6-5.8-6.4 3.6-.8 5.3-2.8 5.8-6.4Z"/></svg>
</span>
<span class="who__name">Orla</span>
<span class="who__state" aria-live="polite"><span class="who__line" data-state>Answered in 1.2s</span></span>
</header>
<div class="answer" data-clip>
<p class="answer__text" data-text></p>
<span class="sweep" data-sweep aria-hidden="true"></span>
</div>
<footer class="bar">
<button class="regen" type="button" data-regen aria-label="Regenerate answer">
<span class="regen__bg" data-bg aria-hidden="true"></span>
<span class="regen__icon" aria-hidden="true">
<svg data-arrow viewBox="0 0 24 24"><path d="M19.4 12.6A7.5 7.5 0 1 1 17 6.6"/><path d="M17.6 2.8 17.2 6.9 13.1 6.5"/></svg>
</span>
<span class="regen__label">Regenerate</span>
</button>
<nav class="pager" data-pager aria-label="Answer versions">
<button class="pager__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="pager__count" aria-live="polite"><span class="slot" data-now></span><span class="pager__of">/</span><span class="slot" data-all></span></span>
<button class="pager__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>
</nav>
</footer>
</article>
<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>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.
19 values to change
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 answer button” from Animorio and fit it into my siteThe answer is a paragraph with every word in an inline-block span and the spaces left as text, so lines wrap like prose and every word can be animated on its own with opacity, offset, blur and colour.
A band with a blurred violet gradient crosses the answer with xPercent in SWEEP seconds. Each word starts when the band reaches its centre: the word’s horizontal position, divided by the box width, multiplied by the duration, plus a little for every lower line.
The new text writes itself with a stagger of WORD_STAGGER seconds: each word arrives blurred, violet and four pixels lower. Before writing it the old height of the box is measured, then the new one, and GSAP goes from one to the other with back.out, then lets the height go free.
On click a timeline gives a kick of 28 degrees backwards, a little over a turn that speeds up, then an endless turn. When the answer is written the turn stops and the arrow goes to the next full turn with elastic.out, so it always starts upright again.
Each number sits in a one-line window with overflow hidden: the new number comes in from below while the old one leaves at the top (or the other way round going back), with back.out. The counter opens the first time by widening from zero to its natural width.
| Name | File | Default | What it changes |
|---|---|---|---|
SWEEP | script.js | 1.05 | How many seconds the light takes to cross the answer and melt its words. |
WORD_STAGGER | script.js | 0.032 | How many seconds between one word and the next while the new answer writes itself. |
SPIN | script.js | 0.7 | How long one turn of the arrow lasts while the answer is rewritten. |
SQUEEZE | script.js | 0.95 | How much the button squeezes when pressed (1 = not at all). |
MAX_VERSIONS | script.js | 3 | How many versions of the answer are kept, at most. |
ACCENT | script.js | #6d5efc | The colour of the light, of the border that lights up and of the freshly written words. |
PROMPT | script.js | Suggest an opening line for our spring launch email. | The question above the answer. |
In apps with an AI assistant, under every answer: regenerating is something people do often, and here you see that the old answer doesn’t vanish at once but gets rewritten, and that it stays there, reachable with the version counter.
The card is at most 430 pixels wide and on the phone takes the width of the frame; the text wraps by itself and the spacing at the top and bottom tightens with the height, so card, answer and bar fit whole in the frame. You tap it like any button: no hover, the press still shows.
No movement or spinning: the old answer fades out and the new one fades in, the height changes at once, the numbers change without rolling and the autopilot does not start.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.4 KB; the libraries: GSAP 28 KB.
Tested on 29 October 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.