114

Animated Background Beams

£10 or the whole Vault, £99

A GSAP animated background of ink hairlines carrying light pulses into your call to action: the pointer draws a current, a click sends a ping through the whole network.

intermediate
6 more details
svg-pathsvg-animationambientstaggerpointer-attractionradial-burst

This demo reads better at your own screen size than in the frame below:

Released

About this effect

An animated background beams layer for hero sections. A quiet network of ink hairlines, drawn like a transit map with 45 and 90 degree turns and rounded joints, fans out from behind your content to the edges of the frame. Light pulses travel along it, each a comet with a bright head and a fading tail, and they flow towards your primary button: when one arrives, the button's border flares, so the background visibly powers the call to action.

Read the full effect overview

Move the pointer near a track and it draws a current: pulses on that line speed up and brighten, and fresh pulses are sent towards the junction you are nearest. Click or tap anywhere and a ping spreads out from the closest junction through the whole network, staggered by distance along the lines, sparking where two fronts meet and converging on the button. The network is plain SVG you author yourself, so it restyles and rewires without touching the script.

Animated Background Beams - GSAP animation effect preview

What's included

10 items
  • Comet pulses with a bright head and a fading tail, in one accent colour
  • Pulses flow into a target element and flare its border on arrival
  • Pointer current: the nearest track brightens and its pulses speed up
  • Click or tap pings spread through the real network, staggered by distance along the lines
  • Radial sparks where two fronts of a ping meet at a junction
  • Bring your own network: any SVG path is a track, any marked circle a junction
  • Content marked as calm dims the pulses behind it, so copy stays readable
  • One intensity setting, an ambient rate and speed, and off switches for ambient pulses and the pointer current
  • Runs only while on screen and the tab is visible; pausable from JavaScript
  • Reduced motion shows a still network with resting pulses; keyboard users can send a ping too

Perfect for

4 use cases
  • SaaS and developer-tool heroes where the background should lead the eye to the sign-up button
  • Logistics, payments or infrastructure landing pages that want a network or routing motif
  • Product launch pages that need movement without a video or a WebGL canvas
  • Waitlist and pricing headers where one call to action deserves the attention

How it works

3 sections

The network is inline SVG: hairline paths for the tracks and small circles for the junctions, with one junction pinned underneath the button so the lines appear to plug into it. Junctions are joined wherever track ends meet, so the effect knows which lines connect and how far apart every junction is along them.

GSAP owns all of the motion. Each pulse is a GSAP timeline that carries a comet from one junction to the next along the stroke, using stroke dash animation, and chains the legs of its route towards the button. A ping is a single timeline whose pulses start in order of distance along the lines from the junction you clicked, which is the stagger that makes the wave read as one front. Sparks are short radial bursts, the button flare is a GSAP tween of a CSS custom property, and GSAP also swaps the moving network for the reduced-motion still when the visitor's motion preference changes.

Pulse elements are pooled and capped, so a busy network never creates new elements per frame, and everything pauses when the layer leaves the screen or the tab is hidden.

Difficulty Intermediate
Includes HTML + JS + CSS source, documentation, AI setup prompt, lifetime updates

Lighthouse, as measured

Google Lighthouse on this effect's demo, from the latest scan. A measurement of the demo as shipped, not a promise for your page.

Accessibility
100
Best practices
100

No performance score, on purpose. That figure depends on how you deploy: your server's compression and caching, your CDN, the connection and the device doing the test, none of which the code controls. The same page can score very differently on two consecutive runs, so measure it where it will live.

Paid effect

Purchase to unlock the code.

Buying Animated Background Beams opens the HTML, CSS and JavaScript source, the full documentation, an AI setup prompt for your editor, and every update we ship to it. Standard license: unlimited personal and commercial projects. Every paid product is tested for desktop and mobile layouts, reduced-motion handling, animation cleanup and keyboard controls wherever there is something to operate.

£10 Standard license, unlimited projects

Browse free effects

Or the whole library: the Vault, £99, one payment.

Documentation

Quick Start

1. Add to your HTML <head>:

Code snippet omitted: it ships with the download.

2. Put the layer inside any positioned container, before your content:

Code snippet omitted: it ships with the download.

3. Add before the closing </body> tag:

Code snippet omitted: it ships with the download.

The demo's index.html holds the full network used in the preview; copy it as a starting point.

Using It With Your Own Design

What the effect needs from your markup:

  • One [data-beams] element holding one inline <svg> with a viewBox. The layer fills its parent (position: absolute; inset: 0), so the parent must be positioned. Clicks, taps and pointer movement anywhere in that parent drive the effect.
  • Tracks: every <path data-beam>. Draw them in SVG units where one unit is one CSS pixel at a 1200px-wide layer; the script scales the network with the layer (from 0.6x on phones up to 1.5x on wide screens).
  • Junctions: every <circle data-beam-node>. Two tracks are connected where their ends meet (within 2 units), so split a line into separate paths at each junction. A track end with no circle is still a junction, just an invisible one; off-frame line ends work this way.
  • The hub: the junction with data-beam-hub. The script positions the whole SVG so the hub sits exactly under the centre of the data-beams-target element. Pulses flow towards it, and the target flares when they arrive. With no target, the hub sits at the centre of the layer.

What is only the demo's styling: the Inter type, the headline and button styling, the ground colour and the network's shape. Draw any network you like: 45 and 90 degree turns with rounded corners give the transit-map look, but the script accepts any path.

CSS the effect depends on:

  • [data-beams] { position: absolute; inset: 0; overflow: hidden; pointer-events: none }, and your content above it (position: relative; z-index: 1).
  • .has-js [data-beams] > svg { visibility: hidden } keeps the network from jumping before it is placed; the script reveals it.
  • The track and node strokes use calc(1.25px * var(--beams-unit, 1)), which keeps hairlines the same thickness at any scale.
  • The flare: the script tweens --beams-flare from 0 to 1 and back on the target element. Your button styles decide what that does; the demo mixes the border towards the pulse colour and adds a soft ring.

Colours are CSS custom properties, read once when the effect starts. Set them on the layer or any ancestor:

Property Default Used for
--beams-line rgba(20, 20, 18, 0.16) The hairline tracks (CSS)
--beams-node #f7f7f6 Junction fill, and the colour a flashed junction returns to
--beams-pulse #f2541b Pulses, sparks, lit tracks and the flare

Options

Set on the [data-beams] element. Every number accepts an explicit 0.

Attribute Values Default Description
data-beams-target CSS selector none The element that sits on the hub and flares when pulses arrive
data-beams-rate Number 0.85 Ambient pulses per second (about half that on touch devices)
data-beams-speed Number 1 Speed multiplier for every pulse and ping
data-beams-ambient 0, 1 1 0 turns off ambient pulses and the opening ping
data-beams-current 0, 1 1 0 turns off the pointer current
data-beams-intensity 0 to 1 1 Scales the whole response: pulse brightness, lit tracks, sparks, flare

On tracks and content:

Attribute On Description
data-beam <path> A track
data-beam-node <circle> A junction
data-beam-hub one <circle> The junction pinned under the target
data-beam-wide <path> Hidden under 600px by the demo CSS; the script drops any hidden track from the network
data-beam-rest <path> 0 to 1: where a resting pulse mark sits on this track under reduced motion. Without any, the three longest tracks get one
data-beams-calm any element in the container Pulses passing behind it dim to this fraction (default 0.2) so copy stays readable
data-beams-ignore any element Clicks on it do not send a ping (links, buttons and form fields are already ignored)

Accessibility

  • Reduced motion: the network is a still with three resting pulse marks. A click or tap lights the whole network and the button at once, with no travelling pulses, then fades back.
  • Keyboard: the layer is focusable (it gets tabindex="0", role="button" and an aria-label unless you set your own). Enter or Space lights the network and flares the target at once rather than playing the wave.
  • Touch: a tap pings; dragging sideways draws the current; vertical drags still scroll the page (touch-action: pan-y). Phones get fewer ambient pulses.
  • Readable copy: mark text with data-beams-calm and pulses dim behind it. The SVG is aria-hidden.
  • No JavaScript: the network shows as a still drawing.

Performance Notes

  • Pulse elements are pooled (at most 64 per layer) and reused; nothing is created per frame.
  • The network graph is built once from the path ends, and rebuilt only when the set of visible tracks changes.
  • Every animation pauses while the layer is off screen or the tab is hidden. With ambient pulses off, an idle layer runs nothing.

Dependencies

Required:

  • GSAP 3.12+ (core only; the demo pins 3.15.0)

Worked examples, the events and programmatic API, and the class reference ship with the download, alongside the full source.