Skip to content
animorio
IT
All components

Undo send button

Buttons, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 6.2 KBGSAP 28 KBFreeDownload the zip

Someone searched for “undo send” and the library returned things that had nothing to do with it. The Send button of a mail app, black on white, with a drawn paper plane: on click the plane takes off along a curve leaving a thin blue trail that fades, and the pill widens on a spring into Undo, with a thin ring running out over five seconds and a rolling number. Press Undo and the plane flies back the same way and slips into the pill, which turns back into Send with a small bounce; if time runs out the pill turns blue, the tick draws itself and it says Sent, then goes back to Send. Below, a rolling line says what is happening: the draft, sending in how many seconds, back in your drafts, sent.

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>
<!--
  "Undo send 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>Undo send 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 Send button of a made-up mail app: the paper plane takes off, the pill becomes Undo with a ring that
         runs out in five seconds; Undo brings the plane back, time out turns it into Sent -->
    <div class="wrap" data-wrap>
      <div class="fly" aria-hidden="true">
        <svg class="trail" data-trail-svg><path class="trail__path" data-trail pathLength="1"></path></svg>
        <span class="plane plane--fly" data-plane>
          <svg viewBox="0 0 24 24"><path class="plane__body" d="M3.4 11.2 20.6 3.6 15 20.4l-3.6-6.9z"></path><path class="plane__fold" d="M11.4 13.5 20.6 3.6"></path></svg>
        </span>
      </div>

      <button class="pill" type="button" data-pill aria-label="Send">
        <span class="pill__lift" data-lift>
          <span class="pill__bg" data-bg></span>
          <span class="pill__sheen" aria-hidden="true"></span>

          <span class="face face--send" data-face="send">
            <span class="face__label">Send</span>
            <span class="plane plane--home" data-home aria-hidden="true">
              <svg viewBox="0 0 24 24"><path class="plane__body" d="M3.4 11.2 20.6 3.6 15 20.4l-3.6-6.9z"></path><path class="plane__fold" d="M11.4 13.5 20.6 3.6"></path></svg>
            </span>
          </span>

          <span class="face face--undo" data-face="undo" aria-hidden="true">
            <svg class="ring" viewBox="0 0 20 20">
              <circle class="ring__track" cx="10" cy="10" r="8"></circle>
              <circle class="ring__left" cx="10" cy="10" r="8" pathLength="1" transform="rotate(-90 10 10)" data-ring></circle>
            </svg>
            <span class="face__label">Undo</span>
            <span class="count" data-count><span class="count__n">5</span></span>
          </span>

          <span class="face face--sent" data-face="sent" aria-hidden="true">
            <svg class="tick" viewBox="0 0 20 20"><path d="M4.6 10.4 8.3 14 15.6 6.4" pathLength="1" data-tick></path></svg>
            <span class="face__label">Sent</span>
          </span>
        </span>
      </button>

      <p class="note" aria-live="polite"><span class="note__line" data-note>Draft to Ada Lind</span></p>
    </div>
  </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.

19 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Undo send 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

In the middle of a white page sits a 60 pixel black pill with «Send» and a paper plane drawn in a white line; below, in grey, «Draft to Ada Lind». On hover the pill lifts a pixel and lightens a touch, and the plane leans forward, ready to go. Pressed, the pill sinks to 0.955 and comes back on an elastic. On click the plane leaves the pill and flies up and to the right along a curve, shrinking and fading, drawing a thin blue trail behind it that dies away. Meanwhile the Send label lifts away blurring, the pill widens on a spring to its new size, and «Undo» rises from below with a thin ring and a grey 5: the ring runs out over five seconds and the number drops by one every second, rolling. Press Undo and the plane flies back along the same curve, a little quicker, the pill narrows with a bounce and the plane slips back into place with a small settle: the line says «Back in your drafts». If nobody presses, the pill turns blue, the tick draws itself and it says «Sent»; a moment later it turns black again, the plane comes back and it all starts over.

How it works

Three faces, one pill

Inside the pill sit three stacked faces, Send, Undo and Sent, each a flex row with its own padding. The script measures them one by one with getBoundingClientRect and takes the pill’s width to the face it shows, with back.out for the spring; the sizes are taken again on resize and once the font has arrived.

The flight is a curve

The flying plane is a copy outside the pill, in a layer over the button that clips nothing. The path is a quadratic curve from the plane’s place in the pill to a point up and to the right; a single number from 0 to 1 says where it is, and on every frame the script works out the point, the direction (the curve’s derivative) and the scale.

The trail follows the same number

The trail is the same curve written in a path with pathLength 1: its stroke-dashoffset is 1 minus the flight number, so it draws exactly behind the plane, and it dies away in the last part of the flight.

The return is the flight backwards

Undo stops the count and takes the same number back to 0 from wherever it was: the plane retraces the curve, even if stopped mid-flight. Just before it arrives the pill narrows on its spring, so the plane slips into a pill that is already the right size.

The countdown

A five second linear tween drives the ring (stroke-dashoffset from 0 to 1 on a circle turned by -90 degrees, so it starts at twelve o’clock) and, whenever the whole second changes, rolls the number and the line below. At the end it calls Sent.

Values to change

NameFileDefaultWhat it changes
RECIPIENTscript.jsAda LindWho the email goes to, written in the line under the button.
UNDO_TIMEscript.js5The seconds to undo the send: how long the ring takes to run out.
FLIGHT_TIMEscript.js0.9How long the plane flies when it takes off, in seconds.
FLIGHT_HEIGHTscript.js96How high the plane climbs above the button, in pixels.
SPRINGscript.js1.8How far the pill overshoots when it changes width (0 = no bounce).
SENT_HOLDscript.js1.8How long «Sent» stays before going back to Send, in seconds.
LOOP_PAUSEscript.js1.4The pause of the self-running tour between one send and the next, in seconds.

Try them in the Playground

When to use it

On the send button of a mail app, a chat, a contact form or a newsletter, wherever sending something by mistake is costly and a few seconds to think again help.

On phones

The pill drops to 52 pixels and the flight shortens to the room left on the right and above: the plane never leaves the box. A tap does the press, and there is no hover.

With reduced motion

No flight, no springs and no rolling: the faces crossfade, the width jumps to the new size, the ring still runs out and the number changes in place. The self-running tour does not start.

Pitfalls

  • The flying plane cannot live inside the pill: the pill changes width and the flight would be clipped or shifted. It sits in a layer above, with coordinates taken from the resting plane at the moment of the click.
  • The plane drawing already points up-right, at -45 degrees: the rotation taken from the curve must be corrected by 45, otherwise it flies sideways.
  • If Undo comes mid-flight, the return starts from where it is: that is why the flight is a single number and not a timeline to reverse.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 23 November 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