
The elastic button
Buttons, Hover, Text
A coffee bar’s order button, in the style of product interface pieces, on a warm white: the pill’s round window holds a glass seen from the side, with ice at the bottom. On click the cold brew pours and rises with a rippling surface, the cubes lift off and float up, the milk falls through in clouds and curls into the coffee, condensation beads on the cold glass and a drop runs down, the straw drops in and looks broken under the surface; the button says «Ready in 4 min» with the digit rolling.
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>
<!--
"Iced latte order 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 iced latte button with the glass that fills up</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" data-stage>
<!-- a coffee bar's order button: tap it, cold brew pours over the ice in the glass,
the cubes float up, milk falls through in clouds, a straw drops in and the order is ready -->
<div class="order" data-order>
<p class="order__top">
<span class="order__shop">Fernhill Coffee</span>
<span class="order__where">Bar 2 · pick up at the counter</span>
</p>
<button class="btn" type="button" data-btn data-autoclic aria-pressed="false">
<span class="btn__glass" data-window aria-hidden="true">
<svg class="glass" data-glass viewBox="0 -4 60 78">
<defs>
<clipPath id="dentro"><path d="M14.7 11.2 45.3 11.2 42.6 63.6 17.4 63.6Z"/></clipPath>
<linearGradient id="caffe" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#7a4b2a"/>
<stop offset="0.35" stop-color="#4a2a17"/>
<stop offset="1" stop-color="#2a170c"/>
</linearGradient>
<linearGradient id="latte" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#f3e6d3"/>
<stop offset="0.6" stop-color="#d8bb98" stop-opacity=".85"/>
<stop offset="1" stop-color="#b98c62" stop-opacity="0"/>
</linearGradient>
<linearGradient id="vetro" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#ffffff" stop-opacity=".55"/>
<stop offset="0.12" stop-color="#ffffff" stop-opacity=".08"/>
<stop offset="0.8" stop-color="#ffffff" stop-opacity=".04"/>
<stop offset="1" stop-color="#ffffff" stop-opacity=".35"/>
</linearGradient>
<linearGradient id="fondo-vetro" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#e9eef0" stop-opacity=".7"/>
<stop offset="1" stop-color="#b7c2c6" stop-opacity=".85"/>
</linearGradient>
<filter id="nuvola" x="-30%" y="-30%" width="160%" height="160%"><feGaussianBlur stdDeviation="1.7"/></filter>
<clipPath id="sopra"><rect data-clip-up x="0" y="-10" width="60" height="40"/></clipPath>
<clipPath id="sotto"><rect data-clip-down x="0" y="30" width="60" height="50"/></clipPath>
</defs>
<!-- the shadow on the bar and the glass body behind everything -->
<ellipse class="glass__ombra" cx="31" cy="70.6" rx="17" ry="2.2"/>
<path class="glass__corpo" d="M13.4 10 46.6 10 43.6 69 16.4 69Z"/>
<!-- the stream from the tap, cold brew then milk -->
<rect data-stream x="29" y="-12" width="2" height="0" rx="1" fill="#4a2a17"/>
<g clip-path="url(#dentro)">
<path data-coffee fill="url(#caffe)" d=""/>
<path data-cream fill="url(#latte)" d="" opacity="0"/>
<g data-clouds filter="url(#nuvola)"></g>
<!-- the straw: the part under the surface is shifted, like light bending in the drink -->
<g data-straw-under opacity="0" clip-path="url(#sotto)">
<g transform="translate(1.6 0)"><line class="straw straw--sotto" x1="38" y1="-14" x2="24.5" y2="62"/><line class="straw__righe straw--sotto" x1="38" y1="-14" x2="24.5" y2="62"/></g>
</g>
<g data-ice></g>
<path data-surface class="glass__pelo" d=""/>
</g>
<!-- the straw above the surface (and above the rim) -->
<g data-straw-over opacity="0" clip-path="url(#sopra)">
<line class="straw" x1="38" y1="-14" x2="24.5" y2="62"/><line class="straw__righe" x1="38" y1="-14" x2="24.5" y2="62"/>
</g>
<!-- glass: thick base, rim, highlights -->
<path class="glass__base" d="M17.4 63.6 42.6 63.6 43.6 69 16.4 69Z"/>
<path class="glass__vetro" d="M13.4 10 46.6 10 43.6 69 16.4 69Z"/>
<path class="glass__luce" d="M16.2 13.5 18.3 60"/>
<path class="glass__luce glass__luce--fine" d="M43.2 14 41.6 52"/>
<ellipse class="glass__bordo" cx="30" cy="10" rx="16.6" ry="1.5"/>
<g data-drops></g>
</svg>
</span>
<span class="btn__words">
<span class="btn__label" data-idle><span class="btn__what">Order · Iced latte</span><span class="btn__price">€4.20</span></span>
<span class="btn__label btn__label--busy" data-busy aria-hidden="true">Pouring your latte</span>
<span class="btn__label btn__label--done" data-done aria-hidden="true">Ready in
<span class="roll" data-roll><span class="roll__col" data-roll-col></span></span> min</span>
</span>
</button>
<p class="order__note">
<span class="order__state" data-note-idle>Oat milk · extra ice · to take away</span>
<span class="order__state order__state--done" data-note-done aria-hidden="true">
<svg class="tick" viewBox="0 0 16 16"><path data-tick d="M3.5 8.4 6.6 11.4 12.6 4.8"/></svg>
Order 58 · we’ll call your name
</span>
</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.
20 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 “Iced latte order button” from Animorio and fit it into my siteThe glass is an SVG, but the liquid is not animated piece by piece with GSAP: GSAP animates a few numbers (the level, the milk, the clouds, the ripple, the cold, the straw) and a loop on the ticker redraws from those numbers the surface, the coffee, the milk band, the clouds, the falling thread, the cubes and the condensation. So everything stays consistent: the thread always ends on the surface, the straw always breaks at the surface.
The coffee’s edge is a line of points every two units, raised by two sines with different frequencies that slide over time; their amplitude is the «ripple», which grows while the thread falls and settles with a soft ease-out. All the liquid sits in a clipPath with the inner shape of the glass, narrower at the bottom.
Each cube has a real spring, with velocity and damping: it sits at the bottom until the liquid reaches it, then its target becomes the surface and it rises there by itself, with the right bob. A knock (the straw, the hover) is just a push on its velocity.
The milk is a light band under the surface, with a gradient that fades to nothing, plus eight ellipses blurred by a Gaussian filter: they are born under the thread, sink to different depths, spread and swirl left and right on a slow sine.
The straw is drawn twice: above the liquid, clipped by a rectangle that ends at the surface, and below the liquid, clipped by the complementary rectangle and shifted by 1.6 units. Every frame both rectangles follow the surface, so the refraction kink always stays at the surface.
Sixteen droplets with a highlight, placed on the glass mostly towards the sides with fixed numbers, appear one after another as the «cold» rises; then a bigger drop runs down the side and leaves a clearer trail.
| Name | File | Default | What it changes |
|---|---|---|---|
POUR | script.js | 2.2 | How long the cold brew takes to pour over the ice, in seconds. |
MILK | script.js | 1.6 | How long the milk takes to pour and fall through in clouds, in seconds. |
HOLD | script.js | 3.2 | How many seconds it stays ready before the loop starts again by itself. |
MINUTES | script.js | 4 | The waiting minutes written on the button once the order is placed. |
INK | script.js | #17120e | The colour of the pill. |
ACCENT | script.js | #c9813f | The caramel colour: the straw’s stripes, the digits and the tick. |
For the order button of a bar, a coffee shop or a drinks ordering app, where the wait is part of the pleasure: the glass filling up tells you what is happening on the other side of the counter.
On the phone the pill takes the screen’s width (at most 372 pixels with a 16-pixel margin) and the glass window shrinks to 86 pixels; there is no hover, everything else is the same.
The glass fills with a fade, without the falling thread, without ripples and without bouncing cubes; the straw and the labels appear with a fade and the drawn pointer is not shown.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 9.1 KB; the libraries: GSAP 28 KB.
Tested on 30 October 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.