Skip to content
animorio
IT
All components

Subscribe button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.6 KBGSAP 28 KBFreeDownload the zip

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.

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>
<!--
  "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>

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.

29 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 “Subscribe 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 sits the invitation of a made-up newsletter, The Brackwater Letter: a violet kicker, a headline, a grey line and below a light pill with a line-drawn envelope, the email field and, joined on the right, the black Subscribe button. Under the pill, in grey: Join 12,480 readers. A drawn pointer clicks in the field, which lights up with a soft violet halo, and types nora@studio; it presses Subscribe and the button squeezes, but the address is incomplete: the pill shakes sideways, the envelope wobbles, the border turns red and the line below says Add the ending, like .com or .studio. The pointer goes back to the field and adds .com: the red leaves as soon as you type. Pressed again, the button’s label slides away, the black button spreads on a spring until it covers the whole field, a white arc spins in the middle for a moment, then the pill turns dark green with a check drawing itself and “You’re in. Check your inbox”; below appears You’re reader 12,481, with the last figures rolling. After a few seconds the pill goes back as it was, with an empty field.

How it works

A real form

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

What is missing, in words

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 covers the field

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.

Arc, colour, check

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.

The reader count

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.

Values to change

NameFileDefaultWhat it changes
READERSscript.js12480How many readers the newsletter already has: after subscribing the number goes up by one.
SPRINGscript.js0.62How long the spring that makes the button cover the field lasts, in seconds.
SHAKEscript.js7How many pixels the field shakes by with a wrong address.
HOLDscript.js3.2How many seconds the confirmation stays before going back to the field.
ACCENTscript.js#4f46e5The colour of the caret, the focus and the kicker.
DONE_COLORscript.js#14532dThe colour of the pill once subscribed.
LABELscript.jsSubscribeThe button’s label.

Try them in the Playground

When to use it

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.

On phones

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

With reduced motion

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.

Pitfalls

  • The button that covers the field must be measured on the real pill at click time (clientWidth) and again on resize: written by hand it would be wrong at every width.
  • With the form set to novalidate the address check is entirely ours: without it, the browser shows its bubble and our error never arrives.
  • GSAP writes its transform inline: the shake’s offset sits on the pill and the press scale on the button, so they never wipe each other out.

Libraries

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.

Testing

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