
The elastic button
Buttons, Hover, Text
A post’s like button, with one gesture: pressed, the heart squeezes, fills with a soft red on a spring with a little bounce, six thin strokes open around it and the counter rolls by one. Hold it and a row of drawn reactions rises (heart, thumb, star, flame): the one your finger slides onto takes the heart’s place.
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>
<!--
"Like counter 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 like button with a counter</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 post with its row of actions. A tap on the heart likes it: the heart squeezes, fills with
a soft red on a spring, six thin strokes open around it and the count rolls by one. Holding it opens a small row
of drawn reactions; the one you slide onto replaces the heart -->
<article class="post" data-card aria-label="Post by Oren Vale">
<header class="post__top">
<span class="avatar" aria-hidden="true"><span class="avatar__letters">OV</span></span>
<div class="who">
<span class="who__name">Oren Vale</span>
<span class="who__meta">Tessaly · 2h</span>
</div>
</header>
<p class="post__text">Shipped the new offline mode today. Every edit now saves on the device and syncs the moment you are back.</p>
<div class="actions">
<div class="likewrap">
<!-- the reactions, drawn: they rise one after another while the heart is held -->
<div class="tray" data-tray role="menu" aria-label="Reactions" aria-hidden="true">
<button class="react" type="button" role="menuitem" data-react="love" aria-label="Love" tabindex="-1">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20.2s-7.4-4.4-7.4-10.1A4.2 4.2 0 0 1 12 7.5a4.2 4.2 0 0 1 7.4 2.6c0 5.7-7.4 10.1-7.4 10.1Z"/></svg>
<span class="react__tip">Love</span>
</button>
<button class="react" type="button" role="menuitem" data-react="like" aria-label="Like" tabindex="-1">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7.6 10.6v9H4.6v-9h3Zm0 0 3.5-6.3c1.6 0 2.5 1.1 2.2 2.7l-.6 3.1h5c1.3 0 2.1 1.1 1.8 2.3l-1.6 6c-.3 1.1-1.2 1.9-2.3 1.9H7.6"/></svg>
<span class="react__tip">Like</span>
</button>
<button class="react" type="button" role="menuitem" data-react="star" aria-label="Star" tabindex="-1">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m12 4.2 2.4 4.9 5.4.8-3.9 3.8.9 5.4-4.8-2.5-4.8 2.5.9-5.4-3.9-3.8 5.4-.8Z"/></svg>
<span class="react__tip">Star</span>
</button>
<button class="react" type="button" role="menuitem" data-react="fire" aria-label="Fire" tabindex="-1">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20.6c-3.3 0-5.7-2.3-5.7-5.5 0-3.4 2.7-5 3.5-8.5 1 .9 1.6 2 1.7 3.3 1.3-1.1 2.3-3.2 2.1-5.5 3 2.1 4.1 5.8 4.1 8.3 0 4.1-2.4 7.9-5.7 7.9Z"/></svg>
<span class="react__tip">Fire</span>
</button>
</div>
<button class="like" type="button" data-like aria-pressed="false" aria-label="Like this post, 1,284 likes" aria-haspopup="menu">
<span class="like__fill" data-fill></span>
<span class="like__inner">
<span class="like__icon" data-iconbox>
<svg class="burst" data-burst viewBox="-20 -20 40 40" aria-hidden="true"></svg>
<svg class="glyph" data-glyph viewBox="0 0 24 24" aria-hidden="true"><path data-glyph-path d="M12 20.2s-7.4-4.4-7.4-10.1A4.2 4.2 0 0 1 12 7.5a4.2 4.2 0 0 1 7.4 2.6c0 5.7-7.4 10.1-7.4 10.1Z"/></svg>
</span>
<span class="like__count" data-count>1,284</span>
</span>
</button>
</div>
<button class="pill" type="button" aria-label="86 comments">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 6.8C5 5.8 5.8 5 6.8 5h10.4c1 0 1.8.8 1.8 1.8v7.4c0 1-.8 1.8-1.8 1.8H11l-4 3.2V16h-.2c-1 0-1.8-.8-1.8-1.8Z"/></svg>
<span>86</span>
</button>
<button class="pill pill--icon" type="button" aria-label="Share">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4.5v10M8 8.3l4-3.8 4 3.8M6 12.5v5.3c0 .9.7 1.7 1.7 1.7h8.6c1 0 1.7-.8 1.7-1.7v-5.3"/></svg>
</button>
<span class="hint" data-hint>Hold for more</span>
</div>
</article>
<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.
28 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 “Like counter button” from Animorio and fit it into my siteOn pointerdown a gsap.delayedCall as long as HOLD starts: if the finger lifts before, it is a tap and the heart turns on or off; if the time runs out, the row of reactions opens. The button captures the pointer (setPointerCapture), so the finger can slide out of it up to the reactions.
There is a single drawing, an outlined path: to light it GSAP takes the fill from transparent to the colour and, together, the icon box from 0.55 to 1 with back.out(3.2) and an eight-degree turn that straightens. For the other reactions only the path’s d attribute changes.
Around the icon there are six lines in a larger SVG: each starts with zero length 9 units from the centre, stretches to 16.5 with power3.out, then lets go and fades. One object holds the two radii and the opacity, rewritten every frame.
Each figure of the number is a column from 0 to 9 inside a one-figure window; when the number changes only the columns that differ move, starting from the last one, like a ticking counter.
The row appears with back.out(2) from the corner above the pill and the four reactions rise one after another, five hundredths apart. The one under the finger grows by a third, lifts five pixels and fills; the others shrink a little.
| Name | File | Default | What it changes |
|---|---|---|---|
LIKES | script.js | 1284 | How many likes the post has before the click. |
HOLD | script.js | 0.38 | After how many seconds of pressing the row of reactions opens. |
SQUEEZE | script.js | 0.8 | How much the heart squeezes when pressed (1 = not at all). |
BURST | script.js | 1 | 1 shows the six strokes opening around the heart, 0 does not. |
SPRING | script.js | 0.6 | How long the spring of the filling heart lasts, in seconds. |
For posts, photos, comments or articles in a social network, a community, a blog or an app: a quick tap for a like and a long press for those who want to say a little more.
The same card at the same size, narrowed to the box: a tap lights the heart and a long press opens the row above the finger, which slides to the reaction and lets go there. The Hold for more hint hides on the narrowest screens.
No squeezes, bounces or strokes: the heart and the pill change colour with a fade, the number changes at once and the row of reactions appears and disappears without moving.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.6 KB; the libraries: GSAP 28 KB.
Tested on 25 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.