
The layered button
Buttons, Hover, Physics
The water intake counter of a health app, in the style of product interface pieces, on white: a glass drawn like a real one, with the thickness of its walls, a solid refracting base and the window’s reflections; at every tap on «+ 250 ml» a stream of water comes down from above, splashes, sloshes the surface from side to side and settles with a meniscus on the walls and a few bubbles rising. The total «0.75 / 2 L» rolls like a counter, the day’s glass ticks light up, and at the goal the ticks make a wave.
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>
<!--
"Water counter" 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 water counter 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 health app's water counter: every tap pours 250 ml into a real glass,
the water splashes, sloshes and settles; the total rolls and the day's glasses light up -->
<section class="card" data-card aria-label="Water today">
<header class="card__top">
<span class="card__app">
<svg class="card__drop" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.6C6 4.6 3.6 7.2 3.6 9.9a4.4 4.4 0 0 0 8.8 0C12.4 7.2 10 4.6 8 1.6Z"/></svg>
Tidewell
</span>
<span class="card__heads">
<span class="card__head" data-head-day>Water today</span>
<span class="card__head card__head--goal" data-head-goal aria-hidden="true">Goal reached</span>
</span>
</header>
<p class="total" aria-live="polite">
<span class="total__num" data-num aria-label="0.75 litres"></span>
<span class="total__goal">/ <span data-goal-l>2</span> L</span>
</p>
<div class="glass" data-glass>
<canvas data-canvas aria-hidden="true"></canvas>
</div>
<div class="ticks" data-ticks aria-hidden="true"></div>
<div class="actions">
<button class="add" type="button" data-add>
<span class="add__fill" aria-hidden="true"></span>
<svg class="add__plus" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 3v10M3 8h10"/></svg>
<span><span data-sip>250</span> ml</span>
</button>
<button class="reset" type="button" data-reset>New day</button>
</div>
</section>
<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.
22 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 “Water counter” from Animorio and fit it into my siteThe glass is drawn every frame on a canvas the size of its box, scaled by devicePixelRatio. Every measurement is a proportion of the box: the rim at 8 per cent of the height, the bottom at 95, the half width from 0.4 to 0.31 of the width, the walls 2.2 per cent thick and the solid base 11. The ellipses of the rim, the surface and the floor are 13 per cent as tall as they are wide: that is the slightly-from-above point of view.
The surface is made of 49 columns. Each is a spring pulling back to zero (stiffness 90, damping 3.2) and pulled by its two neighbours (260): a push in one place becomes a spreading wave. Separately there is a slow oscillation, a single spring, that tilts the whole surface from side to side: the stream pushes it while falling and the last splash pushes it harder.
The stream is a timeline: its head comes down from above in 0.16 seconds, the level rises with sine.inOut for the whole of POUR, then its tail drops into the water in two tenths. While the stream is landing, every frame it gives the columns under it a small push, throws drops that fall with gravity and carries a few bubbles down, which then wobble back up.
The glass is a few layers: the two walls filled a faint bluish grey (darker on the shaded side), the base with a horizontal gradient, a white crescent on its lower edge, the rim with light on its upper side, two reflection lines with a vertical gradient that makes them appear and fade, and under the surface a thicker blue line along the walls for refraction.
The number is made of windows one line tall, one per digit, each holding a column from 0 to 9: to show a 7 the column moves up 70 per cent. The digits start from the right, six hundredths apart, with back.out to pass the mark by a pixel; the windows have a soft mask top and bottom, so two digits are never readable at once.
| Name | File | Default | What it changes |
|---|---|---|---|
GOAL | script.js | 2 | The day’s goal, in litres: the full glass. |
SIP | script.js | 250 | How much water each tap adds, in millilitres. |
START | script.js | 750 | How much water has already been drunk when it opens, in millilitres. |
POUR | script.js | 0.9 | How long the pouring stream lasts, in seconds. |
SLOSH | script.js | 1 | How much the water sloshes when it lands (0 = still). |
BUBBLES | script.js | 10 | How many bubbles rise with each pour. |
ACCENT | script.js | #2f7cf6 | The blue of the water, the ticks and the button. |
For a health, wellness or workout app that counts the water you drink, or for any counter of an amount building up towards a goal (coffees, portions, savings): the glass filling up says progress better than a bar.
On the phone the glass is sized on the height too (at most 34-37 per cent of the screen) and the card stays at most 300 pixels wide with a 16-pixel margin; there is no hover, everything else is the same.
No stream, waves, drops or bubbles: the level rises in a moment, the total changes with a fade, the ticks light up without a hop 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.9 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.