
The elastic button
Buttons, Hover, Text
The Archive button of a mail app, alone on white: one gesture, press. The lid of the drawn box lifts, an envelope drops in, the lid snaps shut with a bounce and the label becomes Archived, in blue; next to it Undo slides out, with a thin line counting down the seconds to go back.
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>
<!--
"Envelope archive 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 Archive button with the envelope dropping into the box</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. The Archive button of a mail app: pressed, the lid of the box lifts, an envelope drops in,
the lid shuts and the button says Archived; next to it Undo slides out with a thin line counting down -->
<section class="pezzo" data-pezzo aria-label="Archive this conversation">
<div class="fila" data-fila>
<button class="tasto" type="button" data-tasto aria-live="polite">
<span class="tasto__corpo" data-corpo>
<svg class="scatola" data-scatola viewBox="0 0 24 24" aria-hidden="true">
<g class="busta" data-busta>
<rect x="7.4" y="2.6" width="9.2" height="6.6" rx="1.1"></rect>
<path d="M7.9 3.3 12 6.3l4.1-3"></path>
</g>
<g class="fondo" data-fondo>
<path class="fondo__pieno" d="M4.6 10.4h14.8v8.1a2 2 0 0 1-2 2H6.6a2 2 0 0 1-2-2Z"></path>
<path class="fondo__maniglia" d="M10 14.2h4"></path>
</g>
<g class="coperchio" data-coperchio>
<rect x="3.4" y="7" width="17.2" height="3.4" rx="1.1"></rect>
</g>
</svg>
<span class="scritte" data-scritte>
<span class="scritta" data-scritta="riposo">Archive</span>
<span class="scritta scritta--fatto" data-scritta="fatto">Archived</span>
</span>
</span>
</button>
<span class="posto-annulla" data-posto-annulla>
<button class="annulla" type="button" data-annulla tabindex="-1">
<span class="annulla__scritta">Undo</span>
<span class="annulla__tempo" aria-hidden="true"><span data-tempo></span></span>
</button>
</span>
</div>
<p class="nota" data-nota aria-hidden="true">Re: Studio visit on Thursday</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.
15 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 “Envelope archive button” from Animorio and fit it into my siteThe icon is an SVG with three groups in this order: the envelope, the bottom of the box and the lid. The bottom and the lid are filled with the button’s colour, so the falling envelope disappears behind the bottom without masks, and the lid turns on its hinge with svgOrigin.
Archive and Archived sit on top of each other in a window one line high. The old one leaves in 0.2 seconds, the window’s width goes to the size of the new one and the new one comes in 0.17 seconds later with a small back.out: the two labels are never readable together.
Undo lives in a container zero wide with hidden overflow. GSAP takes the container’s width to Undo’s size: the row stays centred and the button moves aside by itself, without jumps.
The line under Undo is a span whose scaleX goes from 1 to 0 in UNDO_TIME seconds, with no curve. When it ends, Undo slides back and leaves the Tab order; pressing Archived again takes the email out of the archive.
A fake pointer runs the loop by itself for the preview: archive and undo, archive again and let the countdown run out, then unarchive. At the first real touch, click or key the autopilot stops and the button is yours.
| Name | File | Default | What it changes |
|---|---|---|---|
UNDO_TIME | script.js | 5 | The seconds during which Undo can still be pressed. |
SPRING | script.js | 1.6 | How much the lid and the label bounce. |
PRESS | script.js | 0.96 | How much the button squeezes when you press it. |
ACCENT | script.js | #2f5bea | The colour of the archived button. |
LABEL | script.js | Archive | The button’s label. |
DONE_LABEL | script.js | Archived | The label after the click. |
SUBJECT | script.js | Re: Studio visit on Thursday | The email subject under the button. |
In mail, messaging, task or document apps: archiving a conversation, a task, a project, where the action is quick and you must be able to go back for a few seconds without a confirmation dialog.
The same button and the same Undo, both fitting the box’s width; a finger presses like the mouse, without the lid lifting on hover.
No lid, envelope or bounces: the button changes colour, the labels swap with a fade one after the other and Undo appears in place; the time line still shortens, because it is the information.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.6 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.