
The elastic button
Buttons, Hover, Text
The Share button of a document in a made-up docs app, black on black with one gesture: pressed, the pill widens on a spring and shows the short link, who can open it and Copy. Tap the globe and the link turns into “Only people invited” as the lock snaps shut; Copy runs a pass of light along the link, turns into Copied with a check, the pill gives one beat and then folds back into the button.
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>
<!--
"Share link 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 Share button with the link that copies inside the pill</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 Share button of a document in a made-up docs app: pressed, it widens into a long pill with the short link,
who can open it (the globe or the lock, tap it to switch) and Copy; copying sends a pass of light along the
link, Copy turns into Copied with a check, the pill gives one beat and then folds back into the button -->
<div class="wrap" data-wrap>
<div class="pill" data-pill>
<span class="pill__floor" aria-hidden="true"></span>
<span class="pill__halo" data-halo aria-hidden="true"></span>
<div class="pill__clip">
<span class="pill__grain" aria-hidden="true"></span>
<span class="pill__sheen" data-sheen aria-hidden="true"></span>
<button class="share" type="button" data-share aria-expanded="false" aria-controls="share-panel">
<span class="share__in" data-sharein>
<svg class="share__ic" data-shareic viewBox="0 0 24 24" aria-hidden="true">
<path d="M8.2 9.6H7a2.4 2.4 0 0 0-2.4 2.4v6A2.4 2.4 0 0 0 7 20.4h10a2.4 2.4 0 0 0 2.4-2.4v-6A2.4 2.4 0 0 0 17 9.6h-1.2"></path>
<path class="share__arrow" data-sharearrow d="M12 14.4V3.8M8.4 7.2 12 3.6l3.6 3.6"></path>
</svg>
<span class="share__word" data-shareword>Share</span>
</span>
</button>
<div class="panel" id="share-panel" data-panel role="group" aria-label="Share this document">
<button class="acc" type="button" data-acc aria-pressed="false" aria-label="Who can open the link: anyone with the link. Tap to limit it to invited people">
<svg class="acc__ic" viewBox="0 0 24 24" aria-hidden="true">
<g class="globe" data-globe>
<circle cx="12" cy="12" r="7.6"></circle>
<ellipse class="globe__mer" data-mer cx="12" cy="12" rx="3.4" ry="7.6"></ellipse>
<path d="M4.6 12h14.8"></path>
<path class="globe__lat" d="M5.9 8.2h12.2M5.9 15.8h12.2"></path>
</g>
<g class="lock" data-lock>
<path class="lock__shackle" data-shackle d="M8.6 11V8.6a3.4 3.4 0 0 1 6.8 0V11"></path>
<rect class="lock__body" data-lockbody x="6.2" y="10.8" width="11.6" height="8.8" rx="2.6"></rect>
<path class="lock__hole" d="M12 14.2v2"></path>
</g>
</svg>
</button>
<div class="link">
<span class="link__url" data-url>
<span class="link__text"><span class="link__host" data-host>brindle.so/d/</span><span class="link__slug" data-slug>q1-brief</span></span>
<span class="link__glint" data-glint aria-hidden="true"></span>
</span>
<span class="link__who"><span class="link__whoin" data-who>Anyone with the link</span></span>
</div>
<button class="copy" type="button" data-copy aria-label="Copy link">
<span class="copy__ic" aria-hidden="true">
<svg class="copy__chain" data-chain viewBox="0 0 24 24">
<path d="M10.4 13.6a3.6 3.6 0 0 0 5.1 0l2.9-2.9a3.6 3.6 0 0 0-5.1-5.1l-1.1 1.1"></path>
<path d="M13.6 10.4a3.6 3.6 0 0 0-5.1 0l-2.9 2.9a3.6 3.6 0 0 0 5.1 5.1l1.1-1.1"></path>
</svg>
<svg class="copy__check" viewBox="0 0 24 24">
<path data-check d="M5.6 12.6 10 17l8.4-9.4"></path>
</svg>
</span>
<span class="copy__words"><span class="copy__col" data-copycol><span>Copy</span><span>Copied</span></span></span>
</button>
</div>
</div>
<span class="pill__edge" data-edge aria-hidden="true"></span>
</div>
<p class="sr" data-live aria-live="polite"></p>
</div>
<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 “Share link button” from Animorio and fit it into my siteInside the pill a layer with overflow hidden holds the Share button and the open panel, both absolutely positioned. The panel is already as wide as the open pill and centred with a negative margin: GSAP only changes the pill’s width, with elastic.out, and the panel uncovers itself from the middle outwards.
The one pixel edge is an element with 1px of padding and a content-box mask in exclusion: only the frame is left. Its background is a radial gradient centred on --mx, which gsap.quickTo carries behind the pointer with a soft lag.
Over the link sits the same text, transparent, with background-clip: text and a narrow gradient around --gx; GSAP moves --gx from -40% to 140% and the light runs only inside the letters. At the same time a blurred shine crosses the pill under the words.
Globe and lock share one SVG. The globe’s meridian narrows by animating its rx attribute (it seems to spin), then the lock grows with back.out and the shackle drops by 3.4 units; as it lands, the body dips by 0.8 and springs back, and the lock wobbles on rotation keyframes.
Copy writes the link to the clipboard with navigator.clipboard, when the page is secure. The check draws itself with stroke-dashoffset, the two words sit in a column that rises by 50%, the pill goes to 1.04 and comes back with elastic.out, and a halo spreads and fades. After HOLD seconds the pill folds back.
| Name | File | Default | What it changes |
|---|---|---|---|
LABEL | script.js | Share | The label of the closed button. |
LINK | script.js | brindle.so/d/q1-brief | The document’s short link, the one Copy puts on the clipboard. |
ACCENT | script.js | #86adff | The colour of the globe, the pass of light and Copied. |
SPRING | script.js | 0.7 | How long the spring that widens the pill lasts, in seconds. |
BEAT | script.js | 1.04 | How much the pill swells in the beat after copying. |
HOLD | script.js | 1.5 | How many seconds it stays open after Copied before folding back. |
At the top of a document or a note in a writing app, in a dashboard to share a report, on a project or quote page to send to a client: wherever the link is needed and it matters to say who can open it.
The open pill narrows to the screen width minus thirty-two pixels, the circle and Copy get slightly smaller and the link stays whole; a finger presses like the mouse. Without hover the edge light stays still in the middle.
No springs, beats or passes of light: the pill changes width in a moment, the pieces fade in, the lock and the globe swap with a fade and Copied arrives already in place.
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 8 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.