
Ridge line background
Backgrounds, WebGL, Hover
A hand-written WebGL animated background for the opening of a made-up thermal spa, Saltwell, seen from above the pool: on the floor a pale mosaic of glazed tiles, its grout lines bent by the surface, and on it the net of caustic light the water focuses down, sharp where it folds, with a thread of red outside and blue inside its edges, like light split by water. The surface is the sum of twelve slow waves and the light is worked out from how much each patch of water squeezes the sun. The pointer is a finger in the water: it dents the surface under it and leaves rings that spread and fade.
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>
<!--
"Pool caustics background" 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>Saltwell Baths</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.3.0/opsz-italic.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.3.0/opsz.css">
<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>
<!-- the opening of a made-up thermal spa, seen from above the pool: a WebGL shader draws the pale mosaic on the
floor of the basin and the net of caustics the surface throws on it, with a thread of colour on the edges of
the light. The pointer is a finger in the water: it dents the surface and leaves rings that spread and fade -->
<section class="stage" data-stage>
<canvas class="pool" aria-hidden="true" data-canvas></canvas>
<div class="glow" aria-hidden="true"></div>
<header class="bar" data-in>
<span class="brand">
<svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true">
<rect x="3.5" y="3.5" width="17" height="17" rx="2.5"/>
<path d="M3.5 12h17M12 3.5v17" class="brand__grout"/>
<path class="brand__wave" data-wave d="M6.2 15.6c1.9-1.3 3.8-1.3 5.8 0s3.9 1.3 5.8 0"/>
</svg>
Saltwell
</span>
<a class="book" href="#" data-book data-autoclic>
<span class="book__face">
<span class="book__words">Book a soak</span>
<svg class="book__icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h8.5M8.8 4.6L12.2 8l-3.4 3.4"/></svg>
</span>
</a>
</header>
<div class="hero">
<p class="eyebrow" data-in>Thermal baths, open daily from seven</p>
<h1 class="title" data-title>
<span class="title__line">Light, slowed</span>
<span class="title__line">by <em>warm</em> water.</span>
</h1>
</div>
<p class="temp" data-in>
<span class="temp__label">Main pool</span>
<span class="temp__value"><span data-temp>34.0</span> °C</span>
</p>
<p class="sr" aria-live="polite" data-live></p>
</section>
<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.
29 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 “Pool caustics background” from Animorio and fit it into my siteIn the fragment shader the surface is the sum of twelve waves in directions spread by the golden angle, from a tenth to a third of the screen long. Each moves at the speed of deep water, its frequency growing with the square root of the wavenumber: short waves are slower than you would think, and the net moves like real water. For each wave the slope and the curvature are added up, written by hand: no textures, no numerical derivatives.
A ray of sun going through the surface bends as much as the water is tilted, and a small patch of surface reaches the floor wider or narrower depending on the curvature: the light is the inverse of the determinant of I + D·H, with D the depth and H the curvature. Where the determinant goes through zero the light folds onto itself and the sharp line of the caustics appears; a floor at 0.055 avoids infinity and a soft shoulder keeps the knots bright without burning out the tiles.
The same formula is worked out three times at three slightly different depths, one for red, one for green, one for blue (SPLIT, 5% by default): red folds a little further than blue, and each line gets a pinkish thread outside and a blue one inside, like the real dispersion of water. It costs little because the curvature is computed only once.
The tiles are drawn in the shader at the point shifted by the slope of the surface, so the grout lines sway. Each tile has a tone from a hash of its cell and a dome that darkens it towards the edges; the aqua veils it a little more towards the corners, then vignette and grain.
The pointer is a Gaussian dent in the surface that follows it with a soft lag and sinks deeper the faster it moves: the light gathers there as under a lens. Every so often, once it has moved far enough, a ring sets off: a short train of waves on a running front that widens and fades, with slope and curvature computed in radial coordinates. Eight rings at most, the oldest makes room.
Book a soak squashes and springs back on an elastic ease, sends two rings out from its centre, lifts the light and warms the temperature by a tenth for three seconds. Left alone, a GSAP timeline draws a finger under the heading, taps on the right and presses; at the first real movement it stops and starts again three seconds later. Without WebGL a CSS mosaic with two patches of light remains.
| Name | File | Default | What it changes |
|---|---|---|---|
DRIFT | script.js | 1 | How fast the water moves (0 = still). |
LIGHT | script.js | 1 | How bright the caustics are. |
DEPTH | script.js | 1 | How deep the pool is: deeper folds the light into finer, sharper lines. |
SIZE | script.js | 1 | Size of the waves and of the cells of light. |
SPLIT | script.js | 0.05 | How much the water splits the light into colour on the edges (0 = white). |
TILE | script.js | 0.06 | Size of the tiles, as a share of the screen. |
RIPPLE | script.js | 1 | Strength of the rings, from the pointer and the button. |
FINGER | script.js | 1 | How deep the finger dents the surface under the pointer. |
GRAIN | script.js | 0.025 | Strength of the grain. |
SPEED | script.js | 1 | Speed of the walk on its own: 2 twice as fast, 0.5 half. |
LOOP | script.js | true | The walk on its own starts again every time. |
As the background of the first screen of a spa, thermal baths, a hotel or a holiday home with a pool, a pool builder, a swimwear or sunscreen brand, a wellness centre or a swimming app: wherever a lively, calm light is wanted instead of a gradient. The colours are --tile, --grout, --water, --light and --accent in the CSS.
The same animations at adapted sizes: waves and tiles are measured on width and height, so a phone sees cells of light like a large screen, and the heading is measured on the height too. With a finger you touch the water: the dent follows the finger and the rings appear.
The water stays still, no dent and no rings: the light and the caustics fade in; pressing the button the light brightens slightly and the temperature changes without motion.
GSAP 3.15.0, Newsreader (font variabile) 5.3.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 10.0 KB; the libraries: GSAP 28 KB.
Tested on 11 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.