
Ridge line background
Backgrounds, WebGL, Hover
A WebGL animated background for the hero of a small guesthouse in the hills, on a pale plaster wall the morning after the rain: the sun comes in through a window still covered in drops and lays a slanted patch of light on the wall with the shadow of the window cross. Every drop makes a soft ring of shadow with a point of focused light inside it, with a thread of colour on its edge; now and then a drop slides down and leaves a clean trail, a cloud passes and the points melt until the sun is back. The pointer tilts the sun: the patch leans, the points move inside their rings and come into focus where it passes. Pressing Check availability brings out the full sun and the button says Friday is free.
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>
<!--
"Rain on glass 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>Morrow</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.2.10/opsz.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.2.10/opsz-italic.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 hero of a small guesthouse in the hills, on a pale plaster wall the morning after the rain. A WebGL shader
draws the sun coming through a window still covered in raindrops: every drop throws a soft ring of shadow on the
wall with a bright focused point inside it, a few drops slide down the glass and wipe a clean trail, a cloud
passes now and then. The pointer tilts the sun: the patch of light leans and the focused points sharpen where it
passes -->
<section class="stage" data-stage>
<canvas class="wall" aria-hidden="true" data-canvas></canvas>
<div class="patch" aria-hidden="true"><i></i></div>
<header class="bar" data-in>
<span class="brand">
<svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true">
<path d="M3.5 17.5h17"/><path d="M6.5 17.5a5.5 5.5 0 0 1 11 0"/><path d="M12 4.5c1.6 2.1 2.4 3.6 2.4 4.7a2.4 2.4 0 0 1-4.8 0c0-1.1.8-2.6 2.4-4.7z"/>
</svg>
Morrow
</span>
<nav class="nav">
<a class="nav__link nav__link--wide" href="#">Rooms</a>
<a class="nav__link nav__link--wide" href="#">Breakfast</a>
<a class="nav__link nav__link--pill" href="#">The valley</a>
</nav>
</header>
<div class="hero">
<p class="eyebrow" data-in>Twelve rooms above the valley</p>
<h1 class="title" data-title><span class="title__line">Clear by</span> <span class="title__line title__line--it">morning.</span></h1>
<p class="lede" data-in>A quiet house in the hills, where the rain stops before breakfast.</p>
<div class="actions" data-in>
<button class="btn" type="button" data-btn data-autoclic>
<span class="btn__face" data-face>
<span class="btn__shine" aria-hidden="true"></span>
<span class="btn__words" data-words>Check availability</span>
<svg class="btn__icon" viewBox="0 0 16 16" aria-hidden="true">
<path class="btn__arrow" data-arrow d="M3 8h9M8.5 4.2L12.3 8 8.5 11.8"/>
<path class="btn__check" data-check pathLength="1" d="M3.4 8.4l3 3 6.2-6.6"/>
</svg>
</span>
</button>
</div>
<p class="note" data-in data-note>From 140 a night, breakfast included</p>
</div>
<p class="hint" data-in>Move the pointer to tilt the sun</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.
28 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 “Rain on glass background” from Animorio and fit it into my siteThe whole background is a WebGL shader on a single triangle covering the canvas, under the words: the plaster in the shade with its relief, the patch of sun with the window cross, the drops, the trails, the bounced light and the grain. Without WebGL a CSS patch of light with a few soft drops remains.
The patch is a signed-distance rectangle, slanted with a horizontal shear. Its edge softens towards the bottom, because that part of the wall is further from the glass; the window cross is two strips of shadow.
The drops sit in a grid of cells, one per cell with a random radius and place, at two sizes. Each one takes light away in a ring on its edge and gathers it into a Gaussian point inside, moved by the tilt of the sun; three different widths for red, green and blue make the thread of colour. The drops are drawn in the coordinates of the patch, so they lean with it.
On wider columns one drop in two slides down at its own speed with a little wiggle; behind it a narrowing trail, and inside the trail the small drops are no longer drawn: the glass is clean where it passed.
The pointer tilts the sun on a spring: the patch moves the other way and the points move inside their rings. Near the pointer the points tighten and grow brighter. The cloud (a GSAP tween) widens the edge of the patch, dims the light and melts the points, as real diffuse light does.
| Name | File | Default | What it changes |
|---|---|---|---|
RAIN | script.js | 1 | How many drops are left on the glass (0 = clean glass). |
SLIDE | script.js | 1 | How fast the drops slide down the glass (0 = still). |
CAUSTIC | script.js | 1 | How bright the points of light inside the drops are. |
FOCUS | script.js | 1 | How much the pointer brings the points into focus where it passes. |
TILT | script.js | 1 | How far the pointer tilts the sun. |
CLOUD | script.js | 1 | How deep the passing cloud dims the sun (0 = no cloud). |
GRAIN | script.js | 0.025 | How strong the grain is. |
SPEED | script.js | 1 | 2 = the loop on its own twice as fast, 0.5 = half. |
LOOP | script.js | true | Repeats the loop of the sun, the cloud and the button. |
As the background of the first screen of a hotel, a guesthouse or a holiday home, an interior studio, an umbrella or raincoat brand, a weather or wellness app: wherever a calm, real natural light is wanted instead of a gradient. The colours are --wall, --sun, --cool and --accent in the CSS.
The same animations at adapted sizes: on narrow screens the patch of sun takes more of the wall and passes behind the words, the drops are measured on the short side, the heading on width and height; the Rooms and Breakfast links go, and on short screens the label, the bottom line and the note too. With a finger the sun follows the gesture.
Drops, sun and cloud stay still: the light fades in; pressing the button the light warms slightly and the label, the checkmark and the note change without motion.
GSAP 3.15.0, Newsreader (font variabile) 5.2.10, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 10 KB; the libraries: GSAP 28 KB.
Tested on 10 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.