
The elastic button
Buttons, Hover, Text
A post’s Repost button, with a single gesture: pressed, it squeezes, the two arrows of the loop chase each other half a turn and settle, a soft green spreads from the icon, the label leaves and Reposted comes in, six short strokes flick once around the icon and the repost count rolls by one. Hover it again and it says Undo, in soft red.
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>
<!--
"Repost 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 repost button with arrows that chase each other</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. A Repost pill with the loop of two arrows and the count beside it: pressed, it squeezes,
the two arrows chase each other half a turn round the loop and lock, a green tint spreads from the icon, the
label leaves and Reposted comes in, and the count rolls by one. Coming back over it offers Undo -->
<button class="repost" type="button" data-repost aria-pressed="false" aria-label="Repost">
<span class="repost__tint" data-tint aria-hidden="true"></span>
<span class="repost__inner">
<span class="repost__icon" aria-hidden="true">
<svg class="burst" data-burst viewBox="-30 -30 60 60">
<line x1="0" y1="-15" x2="0" y2="-21"></line>
<line x1="13" y1="-7.5" x2="18.2" y2="-10.5"></line>
<line x1="13" y1="7.5" x2="18.2" y2="10.5"></line>
<line x1="0" y1="15" x2="0" y2="21"></line>
<line x1="-13" y1="7.5" x2="-18.2" y2="10.5"></line>
<line x1="-13" y1="-7.5" x2="-18.2" y2="-10.5"></line>
</svg>
<svg class="loop loop--trail" data-trail viewBox="0 0 24 24">
<path d="M5 11V9.5A3.5 3.5 0 0 1 8.5 6H18"></path>
<path d="M19 13v1.5a3.5 3.5 0 0 1-3.5 3.5H6"></path>
</svg>
<svg class="loop" data-loop viewBox="0 0 24 24">
<g class="arrow arrow--top" data-top>
<path d="M5 11V9.5A3.5 3.5 0 0 1 8.5 6H18"></path>
<path d="M15 3l3 3-3 3"></path>
</g>
<g class="arrow arrow--bottom" data-bottom>
<path d="M19 13v1.5a3.5 3.5 0 0 1-3.5 3.5H6"></path>
<path d="M9 21l-3-3 3-3"></path>
</g>
</svg>
</span>
<span class="repost__label" data-win>
<span class="lab" data-lab>Repost</span>
</span>
<span class="repost__rule" aria-hidden="true"></span>
<span class="repost__count" data-count aria-live="polite">1,284</span>
</span>
</button>
<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.
22 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 “Repost button” from Animorio and fit it into my siteThe two arrows are symmetrical: turned by 180 degrees they look the same again, so half a turn with back.out reads as a chase that closes, and the button remembers its angle so undoing turns it back.
A thinner copy of the loop starts half a turn behind and a moment later, fading as it catches up with the arrows; the two heads move 1.6 pixels along their way and come back on an elastic spring.
The green background is a 40-pixel circle centred on the icon: its scale comes from the distance between the icon and the farthest corner of the pill, so it always fills it, whatever the label.
The label window is one line tall: the old word rises and vanishes in 0.15 seconds, then the new one comes from below; the width is measured on the real word with a hidden span, and the pill follows it on a spring.
Every figure is a column from 0 to 9; only the ones that need to change move, starting from the units, with back.out and 0.05 seconds between them.
| Name | File | Default | What it changes |
|---|---|---|---|
REPOSTS | script.js | 1284 | How many reposts the post has before the click. |
SPIN | script.js | 0.75 | How long the half turn of the two arrows lasts, in seconds. |
SQUEEZE | script.js | 0.95 | How much the button squeezes when pressed (1 = not at all). |
TRAIL | script.js | 0.35 | How visible the arrows’ trail is while they turn (0 = no trail). |
BURST | script.js | 1 | 1 = the six strokes flicking from the icon when you repost, 0 = none. |
ACCENT | script.js | #0f9d63 | The repost colour: arrows, label and strokes. |
LABEL | script.js | Repost | The button label at rest. |
LABEL_DONE | script.js | Reposted | The label after reposting. |
Under a post in a social network, a community, an app feed or a blog with comments: anywhere something can be reposted or shared again and the number of times is counted.
The same pill at the same size: a finger presses like the mouse; on a phone there is no hover, so Reposted stays Reposted and a second tap undoes it.
No squeezes, spins, trails or strokes: the arrows turn at once, labels and colours change with a fade and the number changes straight away. The drawn pointer does not run.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.4 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.