
The elastic button
Buttons, Hover, Text
The button that empties the trash of a files app, to be held down: while a red wash crosses it the bin’s lid lifts, the contents sink and the files and megabytes count down to zero. Let go early and everything goes back. At the end the lid drops, the tick appears and the button says how much space came 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>
<!--
"Empty trash 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>Empty trash 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 button that empties the trash: it has to be held; while it fills the lid lifts, the bin drains
and the items count down, then it says how much space came back -->
<div class="et" data-et>
<button class="et__btn" type="button" data-btn aria-describedby="et-hint">
<span class="et__fill" data-fill aria-hidden="true"></span>
<span class="et__icon" aria-hidden="true">
<svg class="et__can" data-can viewBox="0 0 28 28">
<rect class="et__level" data-level x="9.600" y="12.400" width="8.800" height="9.600" rx="1.200"></rect>
<path d="M7.800 11.200l.9 10.500a2 2 0 0 0 2 1.800h6.600a2 2 0 0 0 2-1.800l.9-10.500"></path>
<g data-lid><path d="M6 8.400h16"></path><path d="M11 8.400V6.700a1.300 1.300 0 0 1 1.300-1.300h3.400A1.300 1.300 0 0 1 17 6.700v1.700"></path></g>
</svg>
<svg class="et__tick" data-tick viewBox="0 0 28 28"><path d="M7.500 14.600l4.300 4.300 8.700-9.500"></path></svg>
</span>
<span class="et__text">
<span class="et__label"><span data-label>Empty trash</span></span>
<span class="et__sub"><span data-sub></span></span>
</span>
</button>
<p class="et__hint" id="et-hint"><span data-hint>Hold to empty</span></p>
<span class="et__say" data-say aria-live="polite"></span>
</div>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.
13 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Empty trash button” from Animorio and fit it into my siteHolding down, a tween takes a number from 0 to 1 in HOLD seconds, linearly; on letting go another tween takes it back to zero.
A single function draws the wash (scaleX), the level in the bin (scaleY from the bottom) and the line of files and megabytes, all from the same value.
It has a number of its own: it opens on an elastic as soon as you press and drops with a bounce, turning about its left corner.
When the number reaches 1 the wash fades, the bin shrinks and the tick draws itself with the dashoffset while the two lines of text roll.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #f0453a | The colour of the wash while holding, of the bin’s contents and of the tick. |
HOLD | script.js | 1.2 | For how many seconds the button must be held. |
ITEMS | script.js | 12 | How many files are in the trash. |
SIZE | script.js | 348 | How much space they take, in megabytes (from 1024 up it becomes GB). |
SPRING | script.js | 1 | How much the lid and the button bounce: 0.3 = a little, 2 = a lot. |
LOOP | script.js | true | Left alone, the demo’s pointer lets go too early, then holds all the way. |
In the trash of a files, mail, notes or photos app, and for any action that cannot be undone: deleting a project, leaving a group, resetting data.
The same button, 252 pixels wide at most and 62 tall: it has touch-action none, no text selection and no long-press menu, so the finger can rest on it without the phone doing anything else.
No advancing wash: two presses take the place of the long one, the first changes the line below to “Press again to empty”, the second empties and the words change at once. The demo does not move by itself.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.1 KB; the libraries: GSAP 28 KB.
Tested on 22 November 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.
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.