Skip to content
animorio
IT
Back to the library

Prompt dot grid background

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

An animated background for an AI app’s hero, on near black: behind the headline and the prompt field there is an even grid of fine dots. Every key pressed sends a ring of pale blue light out from the text caret across the grid; the pointer bends it like a lens, and Enter sends one wide wave across the whole screen. Canvas 2D, 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>
<!--
  "Prompt dot grid 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 dot grid background that lights up as you type the prompt</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 assistant, Mira, on near black: behind the words an even grid of fine dots; every key
       pressed in the prompt sends a ring of light out from the caret, the pointer bends the grid like a lens, and Enter
       sends one wide wave across the whole screen -->
  <main class="stage" data-stage>
    <canvas class="dots" data-dots aria-hidden="true"></canvas>
    <span class="vignette" 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">Mira 3 remembers your projects</span>
      </p>
      <h1 class="title" id="hero-title" data-in>Ask anything.<br><span class="title__soft">Watch it think.</span></h1>

      <form class="prompt" data-prompt data-in autocomplete="off">
        <span class="prompt__rim" aria-hidden="true"></span>
        <label class="sr" for="ask">Ask Mira</label>
        <div class="prompt__field">
          <span class="prompt__mirror" data-mirror aria-hidden="true"></span>
          <input class="prompt__input" id="ask" data-input type="text" placeholder="Ask Mira anything" spellcheck="false">
        </div>
        <button class="send" type="submit" data-send aria-label="Send">
          <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M10 15.5V4.5M5 9.5l5-5 5 5"></path></svg>
        </button>
      </form>

      <p class="hint" data-in>
        <span class="hint__key">Enter</span><span>to send</span>
        <span class="hint__sep" aria-hidden="true"></span>
        <span data-status>Mira is listening</span>
      </p>
    </section>
  </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.

27 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 “Prompt dot grid 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 assistant, Mira, on near black: a pill «New · Mira 3 remembers your projects», the two-line headline «Ask anything. Watch it think.», the prompt field with its arrow button and below it «Enter to send · Mira is listening». Behind it there is an even grid of very fine white dots that lights up from the middle outwards on arrival, while the words rise one after another and settle with a one-pixel give. Every letter typed into the field sends a ring of pale blue light out from the text caret itself: the dots it crosses light up, grow a little, shift outwards by a breath and come back; the rim of the field lights up where you are typing and slowly fades. The pointer bends the grid like a lens, spreading the dots around it; when it rests, the lens drifts slowly on its own. Enter sends a wide wave across the whole screen with an echo just behind, the button sinks and springs back, the question rises away and the line below says «Thinking». If nobody types, the field types itself with three questions.

How it works

A grid drawn every frame

The canvas covers the page and on every tick of the GSAP ticker redraws all the dots, each a small ready-made drawing (a soft circle) copied with drawImage: four thousand dots fit easily.

The rings

Each ring has a centre, a speed, a width and a life. For every dot we measure how far it is from the ring’s radius at that moment: a Gaussian bell says how much it lights up, and the same amount pushes it outwards along its direction.

The text caret

An invisible copy of the text, up to the caret, measures where the caret is on screen: that is where each key’s ring starts, and where the rim of the field lights up, with a radial gradient in a CSS variable.

The pointer’s lens

Around the pointer the dots move away from the centre in proportion to a bell, as under a lens, and light up a little. When the pointer has been still for three seconds the lens follows a slow path around the field.

Enter

Enter sends a wider, faster wave and a fainter echo a fifth of a second later; the button squashes and springs back with elastic.out, the question rises and fades, and the status line changes word only after the old one has left.

Typing by itself

A timeline types three questions letter by letter with an irregular but fixed rhythm (slower after spaces and commas) and presses Enter; the first real key stops it, and it starts again after a few quiet seconds.

Values to change

NameFileDefaultWhat it changes
GAPscript.js18Distance between the dots, in pixels.
DOTscript.js1Radius of a resting dot, in pixels.
RING_SPEEDscript.js520Speed of each key’s ring, in pixels per second.
WAVE_SPEEDscript.js1100Speed of the Enter wave, in pixels per second.
GLOWscript.js1How brightly the dots light up.
LENSscript.js120Radius of the pointer’s lens, in pixels (0 none).
TYPE_SPEEDscript.js1Speed of the typing by itself (2 twice as fast).
AUTO_PILOTscript.js5After how many seconds without keys the field types itself (0 never).

Try them in the Playground

When to use it

For the hero of an AI assistant or app, a chat, a launch page: when the prompt field is the centre of the page and the background should answer to what you type, without stealing the headline’s place.

On phones

Same animations: the grid keeps the same distance between dots, the field narrows to the screen width and the lens follows the finger; headline and field are sized on the height too and fit in the box.

With reduced motion

With reduced motion the grid is already lit and still, with no rings or lens, the words fade in and the field still types itself.

Pitfalls

  • A ring lit for its whole life covers the headline: the light is multiplied by a fade squared with its age, and the vignette darkens the middle behind the words.
  • Drawing every dot with arc and a new fillStyle is slow: one ready-made drawing per colour, copied with drawImage and globalAlpha, keeps sixty frames.
  • The text caret has no coordinates: it is measured with an invisible copy of the text in the same font, minus the field’s scroll.
  • The rings must be capped (48 here): a fast typist makes one every few hundredths of a second.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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