
The elastic button
Buttons, Hover, Text
An interface button in the style of product micro-interactions, Press gesture, on very light grey: in a failed sync row, «Retry» with a circular arrow. Pressing it rewinds the arrow backwards for a turn and a half as it slows, the black pill shrinks into a white circle with a thin ring that loads like a real network; the first time it stops, turns red and the pill comes back with a small shake, the second time it closes, turns green and writes «Synced» with a drawn check.
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>
<!--
"Retry 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 Retry button that rewinds</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" data-stage>
<!-- a failed sync row with its Retry button: the arrow rewinds, the pill shrinks into a ring that loads,
then it either fails again with a small shake or turns green with a drawn check -->
<section class="sync" data-card aria-label="Sync status">
<div class="sync__files" aria-hidden="true">
<svg viewBox="0 0 32 32">
<path class="sheet sheet--back" d="M11 4.5h9.5l5 5V24a2 2 0 0 1-2 2H11a2 2 0 0 1-2-2V6.5a2 2 0 0 1 2-2Z"></path>
<path class="sheet" d="M7 8.5h9.5l5 5V28a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V10.5a2 2 0 0 1 2-2Z"></path>
<path class="fold" d="M16.5 8.5v5h5"></path>
<path class="lines" d="M9 19h8M9 22.5h5.5"></path>
</svg>
</div>
<div class="sync__text">
<p class="sync__title"><span class="roll" data-title><span class="roll__in">Sync failed</span></span></p>
<p class="sync__sub" aria-live="polite"><span class="roll" data-sub><span class="roll__in">2 files couldn’t upload</span></span></p>
</div>
<button class="retry" type="button" data-retry aria-label="Retry sync">
<span class="retry__face" data-face></span>
<svg class="retry__ring" data-ring viewBox="0 0 44 44" aria-hidden="true">
<circle class="retry__track" cx="22" cy="22" r="19.5"></circle>
<circle class="retry__arc" data-arc cx="22" cy="22" r="19.5" pathLength="1"></circle>
</svg>
<span class="retry__icon" data-icon aria-hidden="true">
<svg viewBox="0 0 20 20"><path d="M4.2 7.4A6.2 6.2 0 1 1 3.8 12"></path><path d="M3.6 3.4v4.4H8"></path></svg>
</span>
<svg class="retry__check" data-check viewBox="0 0 20 20" aria-hidden="true"><path d="M5 10.4 8.4 13.6 15 6.6" pathLength="1"></path></svg>
<span class="retry__labels" data-labels>
<span class="retry__label" data-label-retry>Retry</span>
<span class="retry__label" data-label-done>Synced</span>
</span>
</button>
</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.
19 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 “Retry button” from Animorio and fit it into my siteThe button has a pixel width that GSAP takes from the width of «Retry» to 40, the circle, and then to the width of «Synced»: both widths are read from the real labels, so any text fits. The face is a separate element that changes colour and shadow, and squashes on press without touching the width.
The icon is a span rotated by GSAP by minus 540 degrees in 1.1 seconds with power4.out, which starts with a snap and slows like a spring; then a slow endless tween keeps it turning while it loads. The small hover turn sits on the svg inside, in CSS, so GSAP’s transform does not wipe it.
The arc is an SVG circle with pathLength 1: its strokeDashoffset goes from 1 to 0 following an object through four stretches with different curves, fast, slower, almost still, the last one. The same value rolls the number of the file being uploaded.
Every other attempt fails: the arc stops at 0.71 and turns red, the pill comes back and a six-step keyframe shakes it by a few fading pixels. When it works, the circle widens in green, the check draws itself with its dashoffset and a one-pixel settle sets it down.
| Name | File | Default | What it changes |
|---|---|---|---|
LOAD_TIME | script.js | 1.8 | The seconds the ring loads before it succeeds or fails. |
SPINS | script.js | 1.5 | How many turns the arrow rewinds when pressed. |
SHAKE | script.js | 5 | How many pixels the pill shakes when it fails again. |
HOLD | script.js | 2.2 | The seconds Synced stays before the button comes back. |
FILES | script.js | 2 | How many files failed to upload. |
OK_COLOR | script.js | #16a34a | The colour of the pill when it worked. |
For any action that can fail and be tried again: a sync, a file upload, a declined payment, a lost connection, an export. It says that it is retrying, how far it is and how it went, in the same place as the button.
The row takes the full width minus the margins and the button stays 40 pixels tall, easy for a finger; under 380 pixels the text tightens a little. A tap does what a click does.
No spins and no shake: the pill goes to the circle and back without stretching, the ring fills, the text changes with a fade and the drawn pointer stays hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.3 KB; the libraries: GSAP 28 KB.
Tested on 26 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.