
The elastic button
Buttons, Hover, Text
The Generate button of an AI writing tool, on black: a dark pill with a small four point star. On hover the star turns a little and a gradient edge of light switches on; pressed, the edge starts circling the button with a soft halo, the star shrinks and two tiny stars orbit it, the label turns into Generating and shimmers, and below the draft writes itself word by word; at the end Done with a check that draws itself, and everything settles.
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>
<!--
"The generate with AI 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 generate with AI button</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 composer of an AI writing tool on near black: a prompt and a Generate button with a four point star.
Hovered, the star turns and a soft gradient edge lights up; pressed, the edge starts to circle the button,
the star splits into two small stars that orbit, the label shimmers, and the draft writes itself below -->
<section class="card" data-card aria-label="Ovrin writing assistant">
<header class="card__top">
<span class="card__doc">
<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M5.5 2.8h6.2l3.3 3.3v11.1H5.5z"></path><path d="M11.5 2.8v3.5H15"></path><path d="M8 10h5M8 12.8h3.6"></path></svg>
Launch notes
</span>
<span class="card__brand">Ovrin</span>
</header>
<form class="prompt" data-form autocomplete="off">
<label class="prompt__label" for="p">Prompt</label>
<textarea class="prompt__field" id="p" data-field rows="2" placeholder="Describe what to write" maxlength="140"></textarea>
<div class="prompt__bar">
<span class="prompt__hint" data-hint>Tone: friendly · 3 lines</span>
<button class="gen" type="submit" data-gen aria-label="Generate">
<span class="gen__halo" data-halo aria-hidden="true"></span>
<span class="gen__ring" data-ring aria-hidden="true"></span>
<span class="gen__face" data-face>
<span class="gen__stars" aria-hidden="true">
<svg class="gen__star" data-star viewBox="0 0 24 24"><path d="M12 2.5c.5 4.6 2.9 7 9.5 9.5-6.6 2.5-9 4.9-9.5 9.5-.5-4.6-2.9-7-9.5-9.5 6.6-2.5 9-4.9 9.5-9.5Z"></path></svg>
<svg class="gen__mini" data-mini viewBox="0 0 24 24"><path d="M12 2.5c.5 4.6 2.9 7 9.5 9.5-6.6 2.5-9 4.9-9.5 9.5-.5-4.6-2.9-7-9.5-9.5 6.6-2.5 9-4.9 9.5-9.5Z"></path></svg>
<svg class="gen__mini" data-mini viewBox="0 0 24 24"><path d="M12 2.5c.5 4.6 2.9 7 9.5 9.5-6.6 2.5-9 4.9-9.5 9.5-.5-4.6-2.9-7-9.5-9.5 6.6-2.5 9-4.9 9.5-9.5Z"></path></svg>
<svg class="gen__check" data-check viewBox="0 0 24 24"><path d="M5.5 12.5l4.2 4.2 8.8-9.2" pathLength="1"></path></svg>
</span>
<span class="gen__label" data-label>Generate</span>
</span>
</button>
</div>
</form>
<div class="draft" data-draft aria-live="polite"></div>
</section>
<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.
20 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 “The generate with AI button” from Animorio and fit it into my siteBehind the button’s face there are two layers with the same conic gradient: the ring, cut out with a mask that leaves only a one and a half pixel border (content-box against the whole box, with mask-composite), and the halo, the same gradient blurred by 12 pixels. Both read their angle from one CSS variable, --ang.
Edge opacity, halo strength, spin speed and orbit radius are fields of one object that GSAP moves from value to value; GSAP’s ticker writes them into the button’s variables on every frame and advances the angle by the speed, so the spin speeds up and slows down smoothly.
The star is a four point SVG path; the two tiny stars are the same shape, smaller, half a turn apart on a 7 by 6 pixel ellipse, with a slight twinkle in size. The orbit radius grows from zero with back.out, so they come out of the star instead of popping in.
Before changing its text the button measures its width, changes it and measures again, then animates the width between the two with back.out: the pill widens on a short spring. Generating has a light gradient sliding through its letters (background-clip text).
The three lines are split into words that come out of a blur 45 thousandths apart; the draft area has a fixed height, so the card never jumps. The autopilot is a single timeline that stops at the first real touch or key.
| Name | File | Default | What it changes |
|---|---|---|---|
PROMPT | script.js | Write a short launch note for offline mode, three friendly lines. | The prompt the autopilot types. |
DRAFT | script.js | Offline mode is here: keep writing on the train, the plane, anywhere.|Every edit saves on your device and syncs the moment you are back online.|Turn it on in Settings, then forget about the signal. | The three lines of the result, split by |. |
GRADIENT_A | script.js | #8b6cff | The first colour of the light edge. |
GRADIENT_B | script.js | #3fb4ff | The second colour of the light edge. |
SPIN | script.js | 1 | How fast the light edge circles while generating (1 = one turn every 1.6 seconds). |
GLOW | script.js | 1 | How strong the glow round the button is. |
THINK_TIME | script.js | 1.6 | The seconds it generates before writing. |
For the button that starts the AI in an editor, a writing tool, an image or code generator, a field that summarises or translates: whenever pressing means waiting a few seconds for an answer.
The card takes the width with a 16 pixel margin, the button drops to 36 pixels and the tone line shortens with an ellipsis; the draft has a fixed height in vh that holds three lines without moving the field. A tap presses and generates like a click; the edge lighting up on hover happens with a mouse, with keyboard focus and with the autopilot.
The edge does not spin and the tiny stars do not come out: the prompt is already written, the button moves to Generating and Done only with the edge light and a fade, and the draft appears without moving.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.5 KB; the libraries: GSAP 28 KB.
Tested on 25 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.