Skip to content
animorio
IT
Back to the library

Sea glitter background

Backgrounds, WebGLWebGL, GSAP, CSS onlyAdvancedCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

The animated background of the opening of Marivelle, an invented small seaside hotel: the bay seen from the terrace in the late afternoon, a low sun over a warm haze laying a path of glitter on the water, thousands of small glints born and dying on the ripples. The sun leans slowly towards the pointer and its path follows, a tap drops a ring on the water; headline, line and Book a stay catch the light of the path under them. One hand-written WebGL shader, with a true sea in perspective.

The code

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>
<!--
  "Sea glitter 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>The sun glitter on the sea background behind the resort headline</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/full.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- the opening of an invented seaside resort, Marivelle: the page is the bay seen from the terrace in the late
       afternoon. A low sun over a warm haze lays a path of glitter on the slow swell: thousands of small glints that
       come and go on the ripples, thinner and finer towards the horizon. The sun leans slowly towards the pointer,
       and its path follows; a tap drops a ring on the water. The headline, the line and Book a stay catch the glitter
       of the path under them. -->
  <main class="stage" data-stage>
    <canvas class="sea" data-sea aria-hidden="true"></canvas>
    <span class="veil" aria-hidden="true"></span>
    <span class="grain" aria-hidden="true"></span>

    <header class="top" data-in>
      <span class="brand">
        <svg class="brand__mark" viewBox="0 0 22 22" aria-hidden="true"><path class="brand__sun" d="M5.2 13a5.8 5.8 0 0 1 11.6 0z"></path><path class="brand__sea" d="M2.5 15.6h17M5.5 18.4h11"></path></svg>
        <span>Marivelle</span>
      </span>
      <nav class="top__nav" aria-label="Main">
        <span>Rooms</span>
        <span>Terrace</span>
        <span>Spa</span>
      </nav>
      <span class="top__link">Reserve</span>
    </header>

    <section class="hero" aria-labelledby="hero-title">
      <p class="pill" data-in data-lit>
        <span class="pill__tag">Reopens 2 May</span>
        <span class="pill__text">Twelve rooms on the bay</span>
      </p>
      <h1 class="title" id="hero-title" data-in data-lit>Where the sun<br>goes slow.</h1>
      <p class="line" data-in data-lit>A small hotel above a quiet bay, breakfast on the terrace until noon and a swim before every meal.</p>

      <div class="actions" data-in>
        <button class="book" type="button" data-book data-lit>
          <span class="book__face">
            <span class="book__rim" aria-hidden="true"></span>
            <span class="book__sheen" aria-hidden="true"></span>
            <span class="book__label">Book a stay</span>
            <svg class="book__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.4 8h9M8.6 4.2 12.4 8l-3.8 3.8"></path></svg>
          </span>
        </button>
        <span class="price">From <b>€240</b> a night</span>
      </div>
    </section>

    <footer class="foot" data-in>
      <span class="foot__item">
        <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M1.5 7.2c1.6-1.4 3.2-1.4 4.8 0s3.2 1.4 4.8 0 3.2-1.4 3.4-.2M1.5 10.8c1.6-1.4 3.2-1.4 4.8 0s3.2 1.4 4.8 0 3.2-1.4 3.4-.2"></path></svg>
        <span>Sea <b data-water>21.4</b>&thinsp;°C</span>
      </span>
      <span class="foot__item">
        <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 11.5a5 5 0 0 1 10 0M1.5 13.5h13M8 2.5v2.2M3.4 4.6l1.4 1.4M12.6 4.6l-1.4 1.4"></path></svg>
        <span>Sunset <b>20:41</b></span>
      </span>
    </footer>

    <svg class="ghost" data-ghost viewBox="0 0 20 20" aria-hidden="true"><path d="M4 2.5v13.2l3.5-3.3 2.4 5.3 2.3-1-2.4-5.2 4.8-.2z"></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>

Playground

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.

35 values to change

Or ask your AI assistant for it

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 “Sea glitter background” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

The first screen of Marivelle, an invented small hotel on a bay: at the top the brand with the sun on the water, the links Rooms, Terrace and Spa and the Reserve button; in the middle the pill «Reopens 2 May · Twelve rooms on the bay», the big headline in a soft serif «Where the sun goes slow.», a line about the hotel, the light «Book a stay» button and next to it «From €240 a night»; at the bottom left the sea temperature, climbing from 20.6 to 21.4 degrees, and on the right the time of sunset. Behind it, over the whole page, the bay seen from the terrace: a fifth of teal sky going down into a golden haze on the horizon, with the low sun and its halo, and below it the dark sea, moved slowly by a long swell and a fine ripple. Under the sun the sea lights up in a path of glitter: every small facet of the waves that points the right way reflects the sun for an instant, so the glints are born and die all the time, wide and sparse up close, dense and fine towards the horizon, where they become a line of light in the haze. The sun leans slowly towards the pointer, left or right, on a spring that goes a hair past and comes back, and its path follows; the higher the pointer, the higher the sun. A tap on the water drops a ring that spreads and bends the glints as it passes. The headline, the line, the rim of the pill and the button catch the gold of the path where it runs under them, and twinkle with the water. Hovering Book a stay sends a sheen across the button and nudges the arrow; pressing it squashes the pill and springs it back, flashes its rim gold, sends the arrow out and back in and drops a ring on the sea from the button. If nobody moves the pointer, a drawn one crosses the water, taps the sea and presses Book a stay.

How it works

A true sea in perspective

A WebGL canvas behind the opening, one triangle covering the screen, at reduced resolution (QUALITY times the density, capped at 1.5). Below the horizon every pixel is a ray going down from the eye and hitting a plane one unit lower: the distance is 1 divided by how far the pixel is below the horizon. So the waves tighten by themselves towards the horizon, as in a photo.

Nine waves and a ripple

The slope of the water is the sum of nine waves in nearby directions, each shorter and lower than the one before, travelling at the speed of real waves (the square root of their frequency). Each wave fades where a pixel covers more than its length, so the far sea never flickers. On top there is a fine ripple made of two noises drifting against each other: that is what makes the glints come and go.

The sky in the sea and the sun in every facet

The slope gives the normal, the view is reflected on it and reads the sky: golden haze below, teal above, the sun’s halo. Fresnel decides how much sky shows: little up close, almost all of it towards the horizon. Where the reflection points straight at the sun a very high exponent gives a very bright glint; a soft curve on the output makes it bloom into white instead of clipping.

The sun on a spring and the rings

The sun sits on a slightly under-damped spring that brings it towards the pointer (FOLLOW) and lifts it a little when the pointer is high; on its own it sways slowly along the horizon. A tap drops a ring, up to four at once: a crest running across the plane of the sea, so in perspective, fading as it spreads.

The light of the path on the words

The path runs straight down under the sun, so the sun’s x in pixels is enough: every frame it becomes a CSS variable for each element that catches light, plus the intensity, which beats with three slow sines that rarely line up. Headline and line are text clipped over two backgrounds, a pale gradient and a golden glow at that point; the rims of the pill and the button are a gradient in a one-pixel mask.

Values to change

NameFileDefaultWhat it changes
SWELLscript.js1How rough the sea is: higher, a wider path and more glints up close.
DRIFTscript.js1How fast the waves travel (0 stops them).
GLITTERscript.js1How bright the glints of the path are.
SUN_HEIGHTscript.js0.07How high the sun is over the horizon: lower, a longer and warmer path.
FOLLOWscript.js0.7How far the sun leans towards the pointer (0 never).
HORIZONscript.js0.79Where the horizon is, from the bottom: 0.79 is a fifth below the top edge.
QUALITYscript.js0.6Canvas resolution compared with the screen: lower is lighter.
AUTO_PILOTscript.js4After how many seconds without a pointer the drawn one moves (0 never).

Try them in the Playground

When to use it

For the opening of a seaside hotel, a resort, a holiday home, a beach club or a cruise: the sea lives behind the headline, answers the pointer gently and keeps the words readable, in the warm light at the end of the day.

On phones

Same animations: the sea is sized on the height of the page, the finger moves the sun like the pointer and a tap drops a ring; the menu folds away, the price goes under the button, and headline and lines are sized with min(vw, vh), inside the box.

With reduced motion

With reduced motion the sea is one still frame, the sun a little to the left and its path full of glints under the headline, which catches the light; the words only fade in and Book a stay lights its rim without moving.

Pitfalls

  • Short waves drawn all the way to the horizon turn into flickering noise: each wave fades once its length is shorter than what one pixel covers there (the squared distance times the focal length, divided by the canvas height).
  • A glint computed with a high exponent goes tens of times over 1: clipped, it becomes a flat blot; with 1 − exp(−colour) it blooms into white and the rest of the scene stays as it was.
  • The reflection of the steepest facets points below the horizon and reads a sky that is not there: the reflection’s y is taken as an absolute value.
  • The path runs straight down under the sun only with a level camera: that is why the horizon moves (HORIZON) instead of tilting the view, and the sun’s x is enough for the light on the words.
  • The ring of a tap goes on the plane of the sea, not on the screen: so it flattens in perspective like a real ring; a tap above the horizon makes none.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Fraunces (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 12 KB; the libraries: GSAP 28 KB.

Testing

Tested on 16 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

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.

All animations