
The elastic button
Buttons, Hover, Text
The alignment bar of a design tool, on white: above, an artboard with three objects inside the selection box; below, the buttons to align left, centre, right, top, middle, bottom and to distribute the spacing. On every click the objects go to their place on a spring, the box follows them and a guide flashes on the chosen edge.
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>
<!--
"Alignment toolbar" 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>Alignment toolbar</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 alignment bar of a design tool: three objects on an artboard line up or spread out on a spring,
the selection box follows them and a guide flashes on the edge they were aligned to -->
<section class="al" data-al aria-label="Alignment">
<div class="al__board" data-board aria-hidden="true">
<span class="al__guide" data-guide></span>
<span class="al__obj al__obj--a" data-obj><i></i></span>
<span class="al__obj al__obj--b" data-obj><i></i></span>
<span class="al__obj al__obj--c" data-obj><i></i></span>
<span class="al__box" data-box><b></b><b></b><b></b><b></b></span>
</div>
<div class="al__bar" role="toolbar" aria-label="Align and distribute">
<button class="al__btn" type="button" aria-label="Align left" data-do="left"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2.500 2v12"></path><rect x="5.000" y="3.500" width="8.000" height="3.200" rx="1"></rect><rect x="5.000" y="9.300" width="5.000" height="3.200" rx="1"></rect></svg></button>
<button class="al__btn" type="button" aria-label="Align horizontal centres" data-do="hcenter"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 2v12"></path><rect x="3.000" y="3.500" width="10.000" height="3.200" rx="1"></rect><rect x="5.000" y="9.300" width="6.000" height="3.200" rx="1"></rect></svg></button>
<button class="al__btn" type="button" aria-label="Align right" data-do="right"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M13.500 2v12"></path><rect x="3.000" y="3.500" width="8.000" height="3.200" rx="1"></rect><rect x="6.000" y="9.300" width="5.000" height="3.200" rx="1"></rect></svg></button>
<span class="al__sep" aria-hidden="true"></span>
<button class="al__btn" type="button" aria-label="Align top" data-do="top"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2 2.500h12"></path><rect x="3.500" y="5.000" width="3.200" height="8.000" rx="1"></rect><rect x="9.300" y="5.000" width="3.200" height="5.000" rx="1"></rect></svg></button>
<button class="al__btn" type="button" aria-label="Align vertical centres" data-do="vmiddle"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2 8h12"></path><rect x="3.500" y="3.000" width="3.200" height="10.000" rx="1"></rect><rect x="9.300" y="5.000" width="3.200" height="6.000" rx="1"></rect></svg></button>
<button class="al__btn" type="button" aria-label="Align bottom" data-do="bottom"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2 13.500h12"></path><rect x="3.500" y="3.000" width="3.200" height="8.000" rx="1"></rect><rect x="9.300" y="6.000" width="3.200" height="5.000" rx="1"></rect></svg></button>
<span class="al__sep" aria-hidden="true"></span>
<button class="al__btn" type="button" aria-label="Distribute horizontal spacing" data-do="disth"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2.500 2v12M13.500 2v12"></path><rect x="6.400" y="4.000" width="3.200" height="8.000" rx="1"></rect></svg></button>
<button class="al__btn" type="button" aria-label="Distribute vertical spacing" data-do="distv"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2 2.500h12M2 13.500h12"></path><rect x="4.000" y="6.400" width="8.000" height="3.200" rx="1"></rect></svg></button>
<span class="al__sep" aria-hidden="true"></span>
<button class="al__btn al__btn--mix" type="button" aria-label="Scatter the objects" data-mix><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2 4.500h2.500c3.500 0 3.500 7 7 7H14M2 11.500h2.500c1.200 0 2-.800 2.700-1.900M14 4.500h-2.500c-1.200 0-2 .800-2.700 1.900M12 2.500l2 2-2 2M12 9.500l2 2-2 2"></path></svg></button>
</div>
<p class="al__note" aria-live="polite"><span data-say>Three objects selected</span></p>
</section>
<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.
11 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 “Alignment toolbar” from Animorio and fit it into my siteEach object has x, y, width and height in a list; the buttons only change those numbers, then one function draws them.
The box that contains them all is computed and each one’s edge, or centre, is brought onto the box’s: the align-to-selection of design tools.
They are sorted by position, the sum of the widths is taken from the box’s width and the room left is split into equal parts.
Each object goes to its new numbers on a spring with a small delay; the selection box animates position and size, the guide scales from zero and fades.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #2f7df6 | The colour of the selection, of the used button and of the first object. |
GUIDE | script.js | #ff3d8b | The colour of the guide that flashes on the alignment edge. |
STAGGER | script.js | 0.05 | The delay between one object and the next when they move. |
SPRING | script.js | 1 | How much the objects bounce: 0.3 = a little, 2 = a lot. |
LOOP | script.js | true | Left alone, the demo’s pointer aligns, distributes and scatters. |
In tools where things are arranged on a surface: graphic and presentation editors, page builders, whiteboards, floor plans, email editors. Also on a design tool’s site, to show the feature.
The same thing, 296 pixels wide at most: the artboard takes the width there is and stays 168 pixels tall at most, the nine buttons fit on one row and are 29 pixels wide each.
The objects and the selection box go straight to the new position, without the spring; the guide appears whole and fades. The demo does not move by itself.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.5 KB; the libraries: GSAP 28 KB.
Tested on 23 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.