
The elastic button
Buttons, Hover, Text
The field of a marketing tool that shortens an address: with “Shorten” the long link squeezes towards the left and the short one takes its place, with the alias after the slash ready to change. The character count drops from 86 to 14, a thin line shortens with it, and the button becomes “Copy” and then a tick.
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>
<!--
"Link shortener" 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>Link shortener</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 link shortener of a marketing tool: the long address squeezes into the short link,
the alias after the slash can be changed, and Copy confirms -->
<form class="ls" data-ls data-state="long" novalidate>
<div class="ls__top"><label class="ls__label" for="ls-url"><span data-outlabel>Long link</span></label><span class="ls__count"><b data-outcount>0</b> characters</span></div>
<div class="ls__field" data-field>
<input class="ls__input" id="ls-url" type="url" inputmode="url" autocomplete="off" spellcheck="false" data-input value="https://haldencandle.co/collections/winter?utm_source=newsletter&utm_campaign=november">
<span class="ls__squeeze" data-squeeze aria-hidden="true"></span>
<span class="ls__short" data-short><span class="ls__domain" data-outdomain>hald.to/</span><input class="ls__alias" type="text" autocomplete="off" spellcheck="false" maxlength="18" aria-label="Alias" data-alias></span>
<button class="ls__btn" type="submit" data-go><span class="ls__face" data-face="shorten">Shorten</span><span class="ls__face" data-face="copy">Copy</span><span class="ls__face" data-face="copied"><svg viewBox="0 0 16 16" aria-hidden="true"><path data-tick pathLength="1" d="m3.600 8.300 2.900 2.900 5.900-6.500"></path></svg></span></button>
</div>
<span class="ls__meter" aria-hidden="true"><i data-bar></i></span>
<div class="ls__foot"><span class="ls__saved"><span data-outsaved>Paste a link and shorten it</span></span><button class="ls__new" type="button" data-new>New link</button></div>
</form>
<span class="live" aria-live="polite" data-live></span>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Link shortener” from Animorio and fit it into my siteA text field cannot be squashed letter by letter: a copy of the address sits on top of it, and GSAP narrows that one towards the left while it fades. The short link comes in just before it ends.
A single number goes from the long link’s characters to the short one’s: it writes the count and, divided by the starting length, gives the size of the line under the field.
Shorten, Copy and the tick sit on top of each other in the same button: at every step one lifts away and the next comes up from below. After copying, a GSAP delay brings Copy back.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #0f9d74 | The colour of the short link, the border and the line after shortening. |
DOMAIN | script.js | hald.to | The short domain. |
ALIAS | script.js | winter | The alias suggested after the slash. |
SQUEEZE | script.js | 0.7 | How many seconds the long address takes to squeeze. |
SPRING | script.js | 1 | How much the button and the short link bounce. |
In a marketing, newsletter or social tool, where campaign links with UTM parameters are prepared; on the share page of a file or document; in any form that turns a long value into a short one to copy.
The block is at most 336 pixels wide and about 130 tall, and narrows with the screen: the long address is cut with an ellipsis, the button stays 92 pixels wide and 44 tall. You type and tap with a thumb; nothing depends on hover.
The long address gives way to the short one at once, without squeezing; count and line take their new value immediately, the words change without rolling and the tick is already drawn. The demo’s pointer does not start.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.6 KB; the libraries: GSAP 28 KB.
Tested on 28 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.
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.