
The elastic button
Buttons, Hover, Text
The header of a shared doc in Quire, a made up collaborative writing app, like a Dribbble shot: a white card with a one pixel edge, layered shadows and, in a recessed well, the stack of avatars of the people viewing it, initials on gradients with a ring of their own colour. As the pointer passes the stack fans out on a spring and every face stretches into a capsule with the name; someone arriving drops in at the front with a little bounce and pushes the others, someone leaving shrinks away and the stack closes up, and the +3 rolls its digits.
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>
<!--
"Fanning avatar stack" 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 stack of avatars viewing the doc that fans out into names</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 header of a shared doc in Quire, a made up writing app. Under the title, in a recessed well, the stack of
the people viewing it: initials on gradients, each with a ring of its own colour. Hovering it the stack fans out
and every face grows into a capsule with the name; people come and go, and the +3 rolls its digits -->
<article class="doc" data-card aria-labelledby="doc-title">
<header class="doc__head">
<span class="doc__icon" aria-hidden="true">
<svg viewBox="0 0 24 24"><path class="doc__sheet" d="M7 3.5h7.2l4.3 4.3v11.2a1.5 1.5 0 0 1-1.5 1.5H7a1.5 1.5 0 0 1-1.5-1.5V5A1.5 1.5 0 0 1 7 3.5z"/><path class="doc__fold" d="M14.2 3.5v3.1c0 .7.5 1.2 1.2 1.2h3.1"/><path class="doc__lines" d="M8.6 11.6h6.8M8.6 14.4h6.8M8.6 17.2h4.2"/></svg>
</span>
<div class="doc__titles">
<h2 class="doc__title" id="doc-title">Spring launch brief</h2>
<p class="doc__meta">Quire <span aria-hidden="true">·</span> Edited just now</p>
</div>
<button class="share" type="button" data-share>
<span class="share__body">
<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M8.3 11.7l3.4-3.4"/><path d="M9.6 6.2l1.3-1.3a3 3 0 0 1 4.2 4.2l-1.3 1.3"/><path d="M10.4 13.8l-1.3 1.3a3 3 0 0 1-4.2-4.2l1.3-1.3"/></svg>
<span>Share</span>
</span>
</button>
</header>
<div class="live" data-live-well>
<button class="stack" type="button" data-stack aria-expanded="false" aria-label="See who is viewing this doc">
<span class="more" data-more aria-hidden="true">
<span class="more__pill"><span class="more__plus">+</span><span class="roll" data-more-roll></span></span>
</span>
</button>
<span class="live__count" data-count aria-hidden="true">
<svg class="doc__eye" viewBox="0 0 20 20"><path d="M2.2 10s2.9-5.2 7.8-5.2 7.8 5.2 7.8 5.2-2.9 5.2-7.8 5.2S2.2 10 2.2 10z"/><circle cx="10" cy="10" r="2.4"/></svg>
<span class="roll" data-count-roll></span>
<span>viewing</span>
</span>
</div>
<p class="doc__foot">
<span class="event" data-event aria-hidden="true"><span class="event__text" data-event-text></span></span>
</p>
</article>
<p class="sr" aria-live="polite" data-live></p>
</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.
24 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 “Fanning avatar stack” from Animorio and fit it into my siteEach person is an absolute span that GSAP moves with x and widens with width; inside, the capsule has a 999 pixel radius, hidden overflow and two box-shadows: a ring the colour of the well and one the colour of the person. Closed it is as wide as the round and only the gradient round shows; open it becomes the round plus the measured name, and the name, already there, is uncovered by the widening.
A function reads the list of who is in and takes the first VISIBLE: closed they sit one ringed round minus OVERLAP apart, open one capsule plus SPREAD apart. Right after the last one sits the +N chip, and the same sum gives the width of the button that is the hover area. On the phone VISIBLE goes down by itself until the open capsules fit the well.
Every settle uses a damped oscillator, 1 minus e to the minus d times t times the cosine of a multiple of half pi: at the end of the tween it is exactly 1, so nothing snaps. The moves have one wave, the landing of someone arriving two, livelier with BOUNCE.
Someone arriving goes to the head of the list and drops from above, from 0.42 to 1 on the landing spring, with a ring that widens once; the next one squashes with scaleX 0.9 and comes back. The one that no longer fits slides to the chip's x and fades out shrinking; someone leaving shrinks on the spot and only then the others close up, and the first of the hidden comes out of the chip.
Each digit is a window one line tall with a fade above and below, over a column from 0 to 9: GSAP takes it to yPercent minus ten times the digit on the same spring, so going up the number rolls up and going down it rolls down. The same function makes the +N and the number of viewers.
| Name | File | Default | What it changes |
|---|---|---|---|
VISIBLE | script.js | 4 | How many faces show before the +N chip (on the phone it goes down by itself if the capsules do not fit). |
OVERLAP | script.js | 0.3 | How much the faces overlap when the stack is closed, as a share of a round with its ring. |
SPREAD | script.js | 6 | The gap between the capsules when the stack is open, in pixels. |
SPRING | script.js | 1 | How springy every move is: 0.5 calm, 2 very bouncy. |
BOUNCE | script.js | 1.6 | How much someone arriving bounces as they land. |
ROLL | script.js | 0.55 | How many seconds the digits take to roll. |
AUTO | script.js | true | Opens the stack and lets people come and go by itself until someone touches it. |
In the header of a document, a whiteboard or a shared file in a collaboration app, in a dashboard that shows who on the team is online, on the page of a project or a meeting: it says at a glance how many people are there and, passing over, who they are, without opening a separate list.
On the phone the faces are a little smaller and the stack shows three people instead of four, so open with the names it fits the well; a tap on the stack opens it and another one closes it. The rest is the same.
Nothing moves: the stack goes straight to its open or closed place and the names fade in, someone arriving fades in at the front, someone leaving fades out, the digits change in place with a fade.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.9 KB; the libraries: GSAP 28 KB.
Tested on 6 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.
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.