
The elastic button
Buttons, Hover, Text
A profile’s Follow button, with one gesture: pressed, it squeezes, the label rolls to Following, the button turns from black to light with a border and widens on a short spring, the follower count rolls by one and a row of mutual followers slides in below. Hover it again and it says Unfollow, 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>
<!--
"Follow 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 follow button that turns into following</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 small profile card and a black Follow button: pressed, it squeezes, the label rolls to
Following, the button turns light with a border and grows on a short spring, the follower count rolls by one
and a row of mutual followers slides in. Hovering Following offers Unfollow -->
<section class="card" data-card aria-label="Profile of Juno Hale">
<div class="card__top">
<span class="avatar" aria-hidden="true"><span class="avatar__glow"></span><span class="avatar__letters">JH</span></span>
<div class="who">
<span class="who__name">Juno Hale</span>
<span class="who__handle">@junohale · Type designer, Lisbon</span>
</div>
</div>
<div class="card__row">
<p class="count"><span class="count__num" data-count aria-live="polite">2,481</span> <span class="count__lab">followers</span></p>
<button class="follow" type="button" data-follow aria-pressed="false">
<span class="follow__ring" data-ring aria-hidden="true"></span>
<span class="follow__fill" data-fill></span>
<span class="follow__inner" data-inner>
<svg class="follow__icon" data-icon viewBox="0 0 24 24" aria-hidden="true">
<path class="i-plus" d="M12 5.5v13M5.5 12h13"></path>
<path class="i-check" d="M5.5 12.4l4.2 4.1 8.8-9"></path>
</svg>
<span class="follow__labels">
<span class="follow__col" data-labels>
<span class="lab" data-lab="follow">Follow</span>
<span class="lab" data-lab="following">Following</span>
<span class="lab" data-lab="unfollow">Unfollow</span>
</span>
</span>
</span>
</button>
</div>
<div class="mutual" data-mutual aria-hidden="true">
<span class="faces">
<span class="face" style="--a:#f4c7a1;--b:#e48f6a">A</span>
<span class="face" style="--a:#b9d3f7;--b:#6f98d8">T</span>
<span class="face" style="--a:#cfe6c7;--b:#7fb06f">R</span>
</span>
<span class="mutual__text">Followed by <b>Ana</b>, <b>Theo</b> and 12 others</span>
</div>
</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.
38 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 “Follow button” from Animorio and fit it into my siteFollow, Following and Unfollow sit one under the other in a window one line tall; GSAP moves the column by 20 pixels per state with back.out, so the new word arrives from below with a settle.
The script measures each state’s word (scrollWidth) plus icon and padding, and takes the button’s width there with back.out(1.7): the pill widens or narrows with a short bounce, never in a jump.
Each figure of the number is a column from 0 to 9 inside a one-figure window; when the number changes only the columns of the figures that differ move, 40 ms apart.
Solid black, white with a border, soft red: fill and shadow live in a small object per state and GSAP carries them onto the button’s fill; the label changes colour with them.
Right after the click the button shows Following even with the pointer on it: Unfollow appears only after leaving and coming back, so a fresh follow is never undone by mistake.
| Name | File | Default | What it changes |
|---|---|---|---|
FOLLOWERS | script.js | 2481 | How many followers the profile has before the click. |
SQUEEZE | script.js | 0.93 | How much the button squeezes when pressed (1 = not at all). |
SPRING | script.js | 0.55 | How long the width spring lasts, in seconds. |
SHOW_MUTUAL | script.js | 1 | 1 shows the row of mutual followers after the click, 0 does not. |
ACCENT | script.js | #6d5efc | The colour of the check, the ring and the focus. |
LABEL | script.js | Follow | The button’s label at rest. |
For the profile of a person, a creator, a brand or a channel: in a social network, a community, an author’s page on a blog or a portfolio, an app with accounts to follow.
The same card at the same size, narrowed to the box: a finger presses like the mouse, and since a phone has no hover, Following stays Following and a second tap unfollows.
No squeezes, jumps or rings: labels and colours change with a fade, the number changes at once and the row of mutual followers appears without moving.
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 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.