Skip to content
animorio
IT
Back to the library

Warming squares background

Backgrounds, HoverGSAP, Canvas, CSS onlyMediumCompressed weight: Demo 8.1 KBGSAP 28 KBFreeDownload the zip

An animated background for the hero of a heatmap app, on almost black, in the style of Libraries.dev: a dense grid of small grey squares that warm up where the pointer passes, turning a fuller and fuller orange and swelling a little. The heat spreads to the neighbours and cools slowly, so the pointer leaves a trail like a real heat map; a click sends a wave of heat and the headline borrows a little light from the heat under its letters.

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>
<!--
  "Warming squares 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 background of squares that warm up under the pointer</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 heatmap analytics tool, Warmline, on near black: behind the words, a dense grid of small
       squares. Where the pointer passes the squares warm up, from grey to orange, and swell a little; the heat spreads to
       the neighbours and cools slowly, leaving a trail like a heat map. A click sends a wave of heat -->
  <main class="stage" data-stage>
    <canvas class="heat" data-heat aria-hidden="true"></canvas>
    <span class="hush" aria-hidden="true"></span>

    <section class="hero" aria-labelledby="hero-title">
      <p class="pill" data-in>
        <span class="pill__tag">Live</span>
        <span class="pill__text">Heatmaps in real time</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 data-title>See where<br>the heat is</h1>
      <p class="lede" data-in>Warmline shows where every visitor lingers, clicks and gives up, square by square, as it happens.</p>
      <div class="actions" data-in>
        <button class="cta" type="button" data-cta>
          <span class="cta__glow" aria-hidden="true"></span>
          <span class="cta__label">Start tracking</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>
        <span class="note">No cookies needed</span>
      </div>
    </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.

24 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 “Warming squares 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

On almost black there is the opening of Warmline, a made-up app that shows where the visitors of a site stop and click: the Live pill with Heatmaps in real time, the large headline See where the heat is, a line of explanation and the light Start tracking button. Behind it, the whole page is a dense grid of small grey squares, cold. On arrival the squares appear from the middle towards the edges, then the words come in. Where the pointer passes the squares warm up: they turn orange, fuller and bigger, and the hottest swell a little and take a touch of white. The heat does not stay still: it spreads to the nearby squares and cools slowly, so the pointer leaves a trail behind it that fades as in a real heat map, longer when the hand moves fast. Even when nothing moves, here and there a square warms up by itself and goes out, like a visitor passing by. The letters of the headline borrow a little light from the heat under them: they get lighter and take an orange halo. On the button the heat grows, the button swells and an orange warmth rises inside it; pressed, it squashes and comes back with an elastic and a wave of heat leaves the button and crosses the grid. A click anywhere sends the same wave from there. A drawn pointer travels the page in a loop that crosses the headline twice, sends a wave, presses the button and starts again.

How it works

The grid as a table of numbers

Every square is a number between zero and one in a Float32Array: its heat. The grid is recomputed on resize, with slightly smaller cells on the phone, and the heat already there is kept. A second array holds the size of every square, which chases its right size one step at a time: so a square swells and settles instead of jumping.

The heat going in

On every frame the pointer warms the cells around it with a Gaussian bell on the distance. The amount grows with the speed of the hand and on the button, and is multiplied by how far the cell is from one, so a hot square fills up more and more slowly and never goes past. The warm spot follows the pointer a moment late, so the trail gets longer when the hand moves fast.

The heat spreading and cooling

Then every cell moves a little towards the average of its four neighbours, and is multiplied by an exponential of time that cools it. Two arrays swap on every frame, one read and one written, so the heat spreads the same way in every direction. Below three thousandths it is set to zero, so the grid really goes cold again.

Few colours, few drawings

The colours are fourteen steps computed once from the :root colours: the first ones grey, then a fuller and fuller orange, the last ones with a touch of white. On every frame the squares of a step are gathered into a single path of rectangles and filled with one fill: fourteen fills at most, even with thousands of squares.

The wave and the letters

A click adds a wave: a ring that grows and warms the cells near its edge, less and less until it goes out. The headline is split into one span per letter; each letter reads the heat of the cell under it and chases it, getting lighter and taking an orange halo. The values are rounded to fortieths, so the page only updates when something really changes.

Values to change

NameFileDefaultWhat it changes
CELLscript.js14The side of each cell of the grid, in pixels.
RADIUSscript.js62How wide the pointer’s patch of heat is, in pixels.
WARMscript.js5.5How fast the pointer warms the squares.
SPREADscript.js0.55How much the heat spreads to the neighbours (0 stays where it is).
COOLscript.js0.45How fast it cools: higher, the trail is shorter.
SWELLscript.js0.35How much the hottest squares swell (0 they keep the same size).
WAVEscript.js1How strong the click’s heat wave is (0 turns it off).
AUTO_PILOTscript.js3After how many seconds without a pointer the drawn one moves (0 never).

Try them in the Playground

When to use it

As the background of the first screen of an app or a piece of software on a dark background, especially one about data, analytics, heat maps, visitors or temperature: the grid is the page of the site and the pointer is the visitor warming it.

On phones

The same heat at adapted sizes: the cells are a little smaller, the patch narrower, the headline goes on two smaller lines. A sliding finger warms the squares and a tap sends the wave.

With reduced motion

The squares all keep the same size and the heat does not travel: under the pointer they only change colour, from grey to orange, and cool where they are. No wave, no squares lighting up by themselves and no drawn pointer; the letters get lighter without moving.

Pitfalls

  • With a single array the heat spread faster to the right and downwards, because every cell read neighbours that were already updated: two arrays swapped on every frame make it go the same way in every direction.
  • A square drawn with a fill of its own needed thousands of fills per frame: gathered into fourteen colour steps, the fills are fourteen at most.
  • Without the threshold of three thousandths the heat never went back to zero and the grid stayed veiled in orange after a minute of use.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 27 October 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