Popular Animation — Reference

Thermo Cursor

The Thermo Cursor is a CSS animation component that an interactive cursor-following thermodynamic heatmap that renders heat trails in real time. Use it for immersive hero backgrounds, creative portfolios, or anywhere you want visitors to feel their presence on the page. It ships as self-contained HTML and CSS with no external dependencies, making it drop-in ready for any modern web project regardless of framework or build system.

cursorheatmapinteractivethermodynamic

When to use the Thermo Cursor

Performance characteristics

How it compares

Unlike equivalent JavaScript implementations, the Thermo Cursor does not require any runtime library — there is nothing to install, bundle, or load asynchronously.

Compared to animated GIFs or video embeds, this CSS component is resolution-independent, theme-able via CSS custom properties, and weighs a fraction of the equivalent media file.

Source code

CSS

css
body { margin: 0; min-height: 100vh; background: #050505; overflow: hidden; }
    canvas { display: block; width: 100%; height: 100%; }

HTML

html
<canvas id="c"></canvas>

Full source

html
<!DOCTYPE html>
<html>
<head>
  <style>
    body { margin: 0; min-height: 100vh; background: #050505; overflow: hidden; }
    canvas { display: block; width: 100%; height: 100%; }
  </style>
</head>
<body>
  <canvas id="c"></canvas>
  <script>
    var canvas = document.getElementById("c");
    var ctx = canvas.getContext("2d", { alpha: false });
    var resolution = 12;
    var coolingFactor = 0.96;
    var grid, cols, rows, w, h;
    var mouse = { x: -1000, y: -1000, px: -1000, py: -1000, active: false };

    function getThermalColor(t) {
      var r = Math.min(255, Math.max(0, t * 2.5 * 255));
      var g = Math.min(255, Math.max(0, (t * 2.5 - 1) * 255));
      var b = Math.min(255, Math.max(0, (t * 2.5 - 2) * 255 + t * 50));
      return "rgb(" + (r + 10) + "," + (g + 10) + "," + (b + 15) + ")";
    }

    function resize() {
      w = canvas.width = window.innerWidth;
      h = canvas.height = window.innerHeight;
      cols = Math.ceil(w / resolution);
      rows = Math.ceil(h / resolution);
      grid = new Float32Array(cols * rows);
    }

    document.addEventListener("mousemove", function(e) {
      mouse.x = e.clientX; mouse.y = e.clientY; mouse.active = true;
    });
    document.addEventListener("mouseleave", function() { mouse.active = false; });

    function update() {
      if (mouse.active) {
        var dx = mouse.x - mouse.px, dy = mouse.y - mouse.py;
        var dist = Math.sqrt(dx * dx + dy * dy);
        var steps = Math.ceil(dist / (resolution / 2));
        for (var s = 0; s <= steps; s++) {
          var t = steps > 0 ? s / steps : 0;
          var mx = mouse.px + dx * t, my = mouse.py + dy * t;
          var col = Math.floor(mx / resolution), row = Math.floor(my / resolution);
          var radius = 2;
          for (var i = -radius; i <= radius; i++) {
            for (var j = -radius; j <= radius; j++) {
              var c = col + i, r = row + j;
              if (c >= 0 && c < cols && r >= 0 && r < rows) {
                var d = Math.sqrt(i * i + j * j);
                if (d <= radius) grid[c + r * cols] = Math.min(1.0, grid[c + r * cols] + 0.3 * (1 - d / radius));
              }
            }
          }
        }
      }
      mouse.px = mouse.x; mouse.py = mouse.y;

      ctx.fillStyle = "#050505";
      ctx.fillRect(0, 0, w, h);

      for (var r = 0; r < rows; r++) {
        for (var c = 0; c < cols; c++) {
          var idx = c + r * cols;
          var temp = grid[idx];
          grid[idx] *= coolingFactor;
          if (temp > 0.05) {
            var x = c * resolution, y = r * resolution;
            var size = resolution * (0.8 + temp * 0.5);
            var offset = (resolution - size) / 2;
            ctx.fillStyle = getThermalColor(temp);
            ctx.fillRect(x + offset, y + offset, size, size);
          } else if (c % 2 === 0 && r % 2 === 0) {
            ctx.fillStyle = "#18181b";
            ctx.fillRect(c * resolution + resolution / 2 - 1, r * resolution + resolution / 2 - 1, 2, 2);
          }
        }
      }
      requestAnimationFrame(update);
    }

    window.addEventListener("resize", resize);
    resize();
    update();
  </script>
</body>
</html>

Frequently asked questions

How do I add the Thermo Cursor to my project?

Copy the full source code from the code block on this page. Paste the <style> block into your stylesheet (or a <style> tag in your HTML head) and the HTML markup into your template. No npm install or build step is required — the animation is self-contained. To customize colors, speed, or size, use Grepped's workspace at grepped.dev/animations/popular/thermo-cursor.

Is the Thermo Cursor free to use?

Yes. All Grepped preset animations are free to use in personal and commercial projects. You may copy, modify, and redistribute the code without attribution. The only limitation is that you may not resell the presets themselves as part of a competing animation library.

Does the Thermo Cursor work on mobile browsers?

Yes. The Thermo Cursor uses standard CSS animations and transforms that are supported in all modern mobile browsers — Chrome for Android, Safari on iOS 9+, Samsung Internet, and Firefox for Android. Where JavaScript is used for interactivity (e.g. cursor effects), it falls back gracefully on touch devices.

Can I customize the Thermo Cursor's colors, speed, or size?

Yes. Open the live customization workspace at grepped.dev/animations/popular/thermo-cursor to adjust the animation with real-time sliders, color pickers, and toggles — no code required. For deeper changes, the source code uses CSS custom properties (variables) so you can edit them directly in your stylesheet.

Want to customize this animation or generate a new one from a text prompt?

Open in Workspace — it's free