Skip to content
animorio
IT
Back to the library

Black sand background

Backgrounds, WebGL, HoverGSAP, WebGL, CSS onlyAdvancedCompressed weight: Demo 11 KBGSAP 28 KBFreeDownload the zip

An animated background for the hero of an AI research assistant: a field of very fine black sand, tens of thousands of WebGL grains carried slowly by the wind over the ripples. Where the pointer passes the sand parts in a groove with two raised rims that catch a warm raking light, a few grains of mica glint, and then the wind fills it again. The button sends a gust and a puff of air running across the sand. In the Libraries.dev style.

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>
<!--
  "Black sand 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 black sand background that parts where the pointer passes</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>
  <!-- the hero of an invented AI research assistant, Siltra, over a field of fine black sand: tens of thousands of
       grains drawn as WebGL points drift slowly in the wind over wind ripples; where the pointer passes the sand parts
       in a groove with two raised rims that catch a warm raking light, then the wind fills it again. The button sends
       a gust and a puff of air across the sand. -->
  <main class="stage" data-stage>
    <canvas class="sand" data-sand aria-hidden="true"></canvas>
    <span class="veil" aria-hidden="true"></span>

    <section class="hero" aria-labelledby="hero-title">
      <p class="pill" data-in>
        <span class="pill__tag">New</span>
        <span class="pill__text">Siltra 3 cites every source</span>
        <svg class="pill__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.5 10.5 8 6 12.5"></path></svg>
      </p>
      <h1 class="title" id="hero-title" data-in>Every answer,<br>sifted from the noise</h1>
      <p class="lede" data-in>Siltra reads your docs, calls and inboxes, and keeps only what your team needs to know.</p>
      <div class="actions" data-in>
        <button class="cta" type="button" data-cta>
          <span class="cta__sheen" aria-hidden="true"></span>
          <span class="cta__label">Try Siltra free</span>
          <svg class="cta__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9.5M8.5 4 12.5 8l-4 4"></path></svg>
        </button>
        <button class="second" type="button" data-second>
          <svg class="second__icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 4.5h11M4.5 8h7M6.5 11.5h3"></path></svg>
          <span>See how it sifts</span>
        </button>
      </div>
      <p class="note" data-in>Private by default. No training on your data.</p>
    </section>

    <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.

22 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 “Black sand 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 an invented AI research assistant, Siltra, that reads docs, calls and inboxes and keeps only what matters: at the top a pill «New · Siltra 3 cites every source», the big warm silver headline «Every answer, sifted from the noise», a grey line, the light «Try Siltra free» button and the dark «See how it sifts» one with the three lines of a sieve. Behind it, over the whole page, a field of very fine black sand: underneath, the surface with the long wind ripples over a slow dune; on top, tens of thousands of grains, each with its own size and grey, that the wind carries slowly to the right, each at its own pace, with a gust now and then. A warm raking light follows the pointer: it lights the side of the ripples facing it and makes a few grains of mica glint for an instant. Where the pointer passes the sand parts in a groove: the grains in the middle are pushed aside into two raised rims, one caught by the light and one in shadow, and the floor stays darker and smooth; after a few seconds the wind fills it again, from the tail towards the finger. A click on the sand sends a puff of air: a ring that runs out and lifts the grains. The button, when pressed, squashes and springs back, a sheen runs across it, and it sends a gust that carries the sand faster and closes the groove, with the puff starting just under it. When nobody touches, a drawn cursor digs a groove all the way round the headline, goes to press the button and leaves. At the top, at the sides and behind the words the sand sinks into the black, so the headline always reads.

How it works

Two drawings in one canvas

A WebGL canvas behind the hero, density capped at 1.5, with two hand-written programs: first the surface, a single triangle covering the screen, then the grains, tens of thousands of points (one every six page pixels) with alpha blending. Both shaders share the same functions, so the sand below and the grains on top take the same light.

The wind ripples

The height of the sand is a slow dune plus the ripples: a fine sine along the wind, bent by two slower sines across it, with its phase warped by 0.6 of its own sine, so the windward side rises gently and the lee side drops steeply as in real sand. The ripples migrate slowly with the wind.

The groove from the trail

The pointer leaves a trail of 32 points, one every 0.05 units, each with its age. For every pixel and every grain the nearest stretch of the trail is found: the distance says where you are in the groove’s profile (a Gaussian trench and two raised rims), the direction says which way it pushes. The grains in the middle are moved onto the rims, which get denser; the profile’s slope goes into the normal.

The raking light and the mica

A low warm light, just beside and above the pointer, lights the sand’s normal: the side of the ripples and of the groove facing it lights up, the other stays in shadow. One grain in three can be mica: a sine to the seventieth power, each at its own pace, makes it glint only where the light is strong.

The wind that fills it in

Every point of the trail ages; after 40% of REFILL the groove gets shallower and disappears. The wind is a pace added up every frame, with a gust now and then; the button’s gust carries the grains faster and ages the trail six times as fast, so the groove closes before your eyes.

Values to change

NameFileDefaultWhat it changes
WINDscript.js1Strength of the wind carrying the grains (0 stops it).
GROOVEscript.js1Width of the groove the pointer leaves.
REFILLscript.js6Seconds before the wind fills the groove again.
GRAINSscript.js1How many grains: 1 normal, 2 twice as many.
GLINTscript.js1How much the grains glint in the light (0 never).
TINTscript.js#ffc98fThe colour of the raking light.
AUTO_PILOTscript.js4Seconds without a pointer before the drawn cursor starts digging again (0 never).

Try them in the Playground

When to use it

As the background of the first screen of an AI app, a research tool or a launch on a dark page: it gives the hero material and something for the pointer to do without stealing the scene from the headline and the buttons.

On phones

The same sand with adapted sizes, with fewer grains because the screen is smaller (still one every six pixels): the headline goes on two smaller lines, the two buttons sit side by side, the bottom line disappears when the page is short. The finger digs the groove like the pointer and the light follows it.

With reduced motion

The sand stands still, already lit, with a groove already dug round the headline: no wind, no moving grains, no cursor. The words are already in place; pressing the button only leaves the sheen running across it.

Pitfalls

  • In WebGL 1 a fragment shader may only have a few rows of uniforms: the trail lives in 32 vec4s, no more, because some phones allow 64 in all.
  • A grain smaller than a pixel vanishes completely on some GPUs: gl_PointSize never goes below 1.
  • Time and wind come from GSAP’s ticker and not from performance.now(): this way the preview bench controls them and the video is always the same, and the grains are born from a fixed-seed generator.
  • In GLSL smoothstep with the first edge bigger than the second is undefined: for a falloff write 1.0 - smoothstep(a, b, x).

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 9 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