
The elastic button
Buttons, Hover, Text
A newsletter sign-up in a single pill, email field and black Subscribe button joined: with a wrong address the field shakes and a red line says what is missing; with the right one the button spreads over the field on a spring, spins a short arc and the whole pill turns into “You’re in. Check your inbox” with a check drawing itself, while the reader count below rolls up by one.
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>
<!--
"Subscribe 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 subscribe button that turns into a confirmation</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: subscribe. An email field and a black Subscribe button share one pill: a wrong address shakes the
field and a red line says what is missing; a good one makes the button spread over the field on a spring,
spin a short arc, and the whole pill turns into the confirmation while the reader count rolls by one -->
<section class="card" data-card aria-labelledby="titolo">
<p class="kicker">The Brackwater Letter</p>
<h1 class="title" id="titolo">One quiet email, every Sunday</h1>
<p class="sub">Essays on design and slow software. No noise, leave any time.</p>
<form class="pill" data-pill novalidate>
<label class="sr-only" for="email">Email address</label>
<svg class="pill__icon" data-mail viewBox="0 0 24 24" aria-hidden="true">
<rect x="3.5" y="6" width="17" height="12.5" rx="2.4"></rect>
<path d="M4.2 7.2 12 13l7.8-5.8"></path>
</svg>
<input class="pill__input" id="email" data-input type="email" inputmode="email" autocomplete="email"
placeholder="you@example.com" spellcheck="false" aria-describedby="hint">
<button class="go" type="submit" data-go>
<span class="go__fill" data-fill></span>
<span class="go__label" data-label>Subscribe</span>
<svg class="go__arc" data-arc viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8.5"></circle></svg>
<span class="go__done" data-done>
<svg class="go__check" viewBox="0 0 24 24" aria-hidden="true"><path data-check d="M5.5 12.6l4.1 4 8.9-9.2"></path></svg>
<span class="go__text"><b>You’re in.</b> Check your inbox</span>
</span>
</button>
</form>
<p class="hint" id="hint" data-hint aria-live="polite">
<span class="hint__ok" data-hint-ok>Join <span class="num" data-num>12,480</span> readers</span>
<span class="hint__err" data-hint-err></span>
<span class="hint__yay" data-hint-yay>You’re reader <span class="num" data-num2>12,480</span></span>
</p>
</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.
29 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 “Subscribe button” from Animorio and fit it into my siteThe pill is a form with an input type=email and a button type=submit: Enter in the field subscribes, Tab reaches the button, and the check is ours (novalidate) so the error shows our way and not as the browser’s bubble.
A small function reads the address piece by piece (empty, no @, no name, no domain, no ending) and returns the right sentence; the line under the pill is aria-live, so screen reader users hear it.
The button sits on the right with absolute position: at rest it is as wide as its word (scrollWidth), confirming GSAP takes it to the pill’s width minus the border with back.out, so it rides over the field like a spring.
One timeline: the label leaves, the arc spins twice with power1.inOut, then the fill turns green, the confirmation comes in and the check draws itself with its dashoffset; at the end a small breath of scale.
Each figure is a column from 0 to 9 in a one-figure window: on subscribing only the columns of the figures that change move, 50 ms apart.
| Name | File | Default | What it changes |
|---|---|---|---|
READERS | script.js | 12480 | How many readers the newsletter already has: after subscribing the number goes up by one. |
SPRING | script.js | 0.62 | How long the spring that makes the button cover the field lasts, in seconds. |
SHAKE | script.js | 7 | How many pixels the field shakes by with a wrong address. |
HOLD | script.js | 3.2 | How many seconds the confirmation stays before going back to the field. |
ACCENT | script.js | #4f46e5 | The colour of the caret, the focus and the kicker. |
DONE_COLOR | script.js | #14532d | The colour of the pill once subscribed. |
LABEL | script.js | Subscribe | The button’s label. |
At the end of an article, in the footer or on the page of a blog, a magazine, a shop or a product that sends a newsletter or wants to collect sign-ups for a waiting list.
The same pill, a little lower and narrowed to the box, with the confirmation set smaller; a finger taps like the mouse and the phone keyboard opens with the at sign ready (inputmode=email).
No shake, springs or spinning arc: on error only the border and the line below change, and the confirmation fades in with the button widening straight.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.6 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.