Skip to content
animorio
IT
Back to the library

Light beam background

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

An animated background for an app’s hero, on near black: a soft cone of light comes down from above like a stage spot and settles on the floor in a bright pool with its horizon line. Fine, slow dust floats inside it, visible only where there is light. The cone leans gently towards the pointer on a spring and opens wider when the pointer reaches the button. In the Libraries.dev style: light as a material on a real piece of interface.

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>
<!--
  "Light beam 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 with a beam of light behind the headline</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 presentation app, Vespra, on near black: behind the words a soft cone of light comes down
       from above like a stage spot, with fine dust floating slowly inside it and a pool of light on the floor; the cone
       leans after the pointer and opens wider when the pointer reaches the button -->
  <main class="stage" data-stage>
    <canvas class="beam" data-beam aria-hidden="true"></canvas>
    <span class="grain" 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">Rehearsal mode is live</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>Step into<br>the light</h1>
      <p class="lede" data-in>Vespra listens while you rehearse and tells you where the room will drift.</p>
      <div class="actions" data-in>
        <button class="cta" type="button" data-cta>
          <span class="cta__shine" aria-hidden="true"></span>
          <span class="cta__label">Start rehearsing</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">Free for your first talk</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.

21 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 “Light beam 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 app for rehearsing talks, Vespra, on near black: a pill «New · Rehearsal mode is live», the big two-line headline «Step into the light», its letters catching the light from above, a grey line and the light button «Start rehearsing» with «Free for your first talk» beside it. On arrival the light comes on like a stage spot finding its current, a small dip and then full, and the words rise one after another. From the top, just above the edge, a cold soft cone of light comes down, widening as it goes, and settles on the floor in a bright pool; a thin horizon line lights up under the pool and a faint reflection runs below the line. Long slow shafts run inside the beam, like light through haze, and fine dust floats in it: tiny grains rising slowly and a few big blurred ones, visible only where there is light. The cone leans towards the pointer on a short spring, and when the pointer reaches the button it opens wider, gets brighter and a light sweeps across the button. Pressed, the button squashes and springs back, the arrow jumps forward and the spot gives a flash that fades slowly. If nobody moves the pointer, a drawn one moves around the page and presses the button.

How it works

The beam, small and blurred

The cone is drawn on a canvas a fifth of the size, with a blur filter, then scaled up onto the big canvas in lighter mode: the edges stay soft like real light and the work costs little even on a phone.

Three cones and the shafts

Three trapezoids one inside the other, the wide halo, the body and the bright core, each with a gradient fading towards the floor. On top, five thin shafts slowly shifting and changing width, like light through haze.

Dust only in the light

Each grain has a position relative to the cone, across and along the axis, so it follows the beam when it leans. Its light fades towards the edges of the cone, near both ends and with the power of the spot. One soft round sprite, drawn once.

The pointer springs

The tilt and the opening of the cone follow the pointer with two hand-written springs, short and slightly soft. On the button the cone opens by OPEN and the light rises; the flash of a press fades exponentially.

Switching on and the drawn pointer

On arrival the power of the spot rises, dips for a moment and then goes full, like a stage lamp; the words rise staggered. After a few seconds without a pointer a looping timeline moves a drawn pointer and presses the button; the first real movement stops it.

Values to change

NameFileDefaultWhat it changes
WIDTHscript.js1How wide the cone is at the bottom (1 normal, 2 twice as wide).
OPENscript.js0.4How much the cone opens when the pointer is on the button.
TILTscript.js12How many degrees at most the cone leans towards the pointer.
DUSTscript.js160How many grains of dust float in the beam.
SPEEDscript.js1Speed of the dust and the shafts (0 stops them).
GLOWscript.js1How strong the light is.
AUTO_PILOTscript.js4After how many seconds without a pointer the drawn one starts moving (0 never).

Try them in the Playground

When to use it

As the background of the first screen of a dark app or software, an event, a launch, a product for public speaking or for the stage: it puts the headline under a spotlight without stealing the scene.

On phones

The same spot with adapted sizes: the cone is narrower in the tall narrow page, the headline goes on two smaller lines and the finger leans the beam like the pointer; tapping the button makes the spot flash.

With reduced motion

The light is already on and still: no tilt, no moving dust and no drawn pointer. On the button the cone widens without a spring, and pressing it the light brightens slightly; the words are already in place.

Pitfalls

  • A filled trapezoid scaled up keeps a sharp edge even at a fifth of the size: a blur filter on the small canvas is needed; where the filter is missing the three stacked cones still give a soft light.
  • The dust must live in the cone’s coordinates, not the page’s: with fixed coordinates, when the beam leans the grains stay out of the light and all go dark at once.
  • The source sits just above the top edge, off the page: inside it, a hard white spot would show at the top, looking like a bulb instead of a stage light.
  • Time comes from GSAP’s ticker: this way the preview bench drives the dust too, and the video always comes out the same.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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