
The inchworm menu
Menus, Hover, Transitions
The Order free swatches button of a made-up furniture studio, Fenn & Ode, for people who want to touch the fabric before buying the sofa. A dark pill on black, with the bouclé swatch in the well on the left and Free on the right. On the tap three fabrics are cut one after the other in the well: the square arrives, the zigzag of the pinking shears draws itself around it while the edge turns to teeth and a couple of thread crumbs fall, then the swatch is tossed in an arc over the label and lands in the tray on the right. A hairline under the pill fills a third for every swatch. With three in the tray they settle in a stack, a green tick draws itself in the well, a light crosses the pill and the label says when they arrive.
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>
<!--
"Fabric swatches 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 Order free swatches button with the fabrics pinked and tossed into 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 button of a made-up furniture studio, Fenn & Ode: pressed, each fabric is cut in the well with pinking
shears, its zigzag edge drawing itself, then tossed over the label into the tray on the right; with three in
the tray the swatches settle in a stack, a tick draws itself and the label says when they arrive -->
<div class="wrap" data-wrap>
<button class="sw" type="button" data-sw data-autoclic>
<span class="sw__body" aria-hidden="true"><span class="sw__light" data-light></span><span class="sw__sweep" data-sweep></span></span>
<span class="sw__edge" aria-hidden="true"></span>
<span class="sw__line" aria-hidden="true"><span data-progress></span></span>
<span class="well" aria-hidden="true">
<span class="well__cut" data-cut>
<span class="fab" data-fab></span>
<svg class="well__svg" viewBox="0 0 30 30"><path class="well__zig" data-zig pathLength="1" d=""></path></svg>
</span>
<svg class="well__done" viewBox="0 0 24 24"><path class="well__tick" data-tick pathLength="1" d="M7.4 12.4 10.6 15.5 16.8 8.7"></path></svg>
</span>
<span class="label">
<span class="label__main"><span data-word>Order free swatches</span></span>
<span class="label__sub"><span data-sub>Up to 3 fabrics · posted free</span></span>
</span>
<span class="tray" data-tray aria-hidden="true">
<span class="tray__free" data-free>Free</span>
</span>
</button>
<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.
21 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 “Fabric swatches button” from Animorio and fit it into my siteA function builds the points of a square whose sides are broken into teeth: the odd points step in by an amplitude. At zero amplitude it is a straight square with the same points, so GSAP takes the amplitude from 0 to 7.5 and the percentage clip-path is rebuilt every frame: the edge is cut while you watch.
The same zigzag, in SVG coordinates, becomes a path with pathLength 1: stroke-dashoffset goes from 1 to 0 in the same time as the cut, with autoRound off so GSAP does not round the line into jumps.
A copy of the swatch is born above the button, where the well is: x slides evenly to its place in the tray, y rises with power2.out and falls with power2.in, and meanwhile the swatch spins once and shrinks to 22 pixels. Positions are read at the moment of the toss, so they work at any width.
In the tray the new swatch starts squashed (scaleX 1.12, scaleY 0.84) from its bottom edge and comes back on an elastic spring; the tray drops a pixel and a half and the swatches already there shift a hair.
Label and small line sit in one-line windows: the new text comes in from below, the old one leaves at the top with the same curve and duration, so they never overlap, and it is removed when it has left.
| Name | File | Default | What it changes |
|---|---|---|---|
LABEL | script.js | Order free swatches | The label of the button at rest. |
SUB | script.js | Up to 3 fabrics · posted free | The small line under the label. |
DONE_LABEL | script.js | Swatches on the way | The label when the swatches are ready. |
ARRIVES | script.js | Arrives Thu 19 Nov · free | When the swatches arrive. |
TEETH | script.js | 5 | How many teeth the zigzag has on each side of the swatch. |
CUT | script.js | 0.45 | The seconds of each cut. |
SPRING | script.js | 1 | How much the swatches bounce when they land. |
HOLD | script.js | 2.6 | The seconds of the confirmation before going back to rest. |
--brass | style.css | #d9b27c | The brass of Free, of the hairline and of the glow while cutting. |
--done | style.css | #a6cf9b | The green of the tick and the confirmation. |
On the page of a sofa, a curtain or an armchair, for a furniture shop, an upholsterer or an interior studio: ordering free fabric swatches before choosing. It also works for samples of wallpaper, leather, yarn or paint.
The pill takes the screen width minus the margins and lines shorten with an ellipsis if needed; the toss reads positions at the moment, so the arc always reaches the tray. Without hover the light stays off, the tap does everything.
No tosses, springs or crumbs: each fabric fades into the well already pinked with the zigzag drawn, then appears in the tray; the hairline still fills, the tick appears already drawn and the labels change with a fade.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.2 KB; the libraries: GSAP 28 KB.
Tested on 15 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.