What is an animated website background?
An animated background is a layer that moves behind the content of a page, most often behind the hero. It gives a site atmosphere and a sense of quality without the weight of a video or the cost of a photo shoot. There are three ways to make one, and the choice decides how it looks and how fast the page stays.
| Technique | How it works | Best for | Cost |
|---|---|---|---|
| Pure CSS | Blurred gradients, conic gradients or beams moved with keyframes | Soft mesh gradients and light beams | Lowest: no JavaScript |
| Canvas 2D or SVG | JavaScript draws shapes each frame, or an SVG filter blends them | Particles, ribbons, gooey blobs, interactive grids | Low to medium, depends on the number of shapes |
| WebGL shader | A fragment shader computes every pixel on the GPU, on one full-screen triangle | Swirls, liquids, flames, aurora, halftones, 3D-looking surfaces | Low if tuned: one draw call per frame |
The 9 kinds of animated background
Most backgrounds fall into one of these families. Pick the family by mood first, then the colours.
- Gradients: soft mesh clouds, grainy sunsets, fluted glass. Calm and versatile; work for almost any brand.
- Swirls: whirlpools, marbled sugar, ink spirals. Hypnotic; best behind short, bold headlines.
- Halftones: dots and engraved lines that swell and ripple. Print and editorial feel.
- Flames: fire walls, gas jets, plasma. High energy; use for launches, music and sport.
- Aurora and nebula: curtains of light, star clouds, film light leaks. Night, travel and space themes.
- Liquids: chrome, molten gold, ink in water, pool caustics, lava lamps. Luxury and product pages.
- Geometric: tiles, isometric cubes, moiré, honeycombs, equaliser bars. Tech and data brands.
- Particles: fireflies, meteors, bokeh, constellations. Depth and wonder without busy shapes.
- 3D surfaces: ridgelines, morphing spheres, dot-grid waves. Futuristic and AI products.

12 animated backgrounds to start from
These are from the BuildMotions backgrounds library, which has 50 of them. Each one comes with a designed hero on top, so you can judge readability with real type rather than an empty screen, plus prompts for Claude Code, Codex, Cursor, Antigravity, Lovable and v0. The shader backgrounds use raw WebGL with no libraries and loop seamlessly every 12 seconds, and each also has a ready-made 12-second MP4 loop and a still image for places where a video or an image is simpler than code.
| Background | Family | What it looks like | Plan |
|---|---|---|---|
| Nimbus | Gradient (pure CSS) | Four blurred lights drifting behind your UI, with palettes, light and dark modes and grain | Free |
| Halo | Gradient (pure CSS) | Soft light beams fanning down and pooling into a glowing floor | Free |
| Peachfuzz | Gradient (shader) | Peach, apricot and rose clouds melting into each other on a bright ground | Free |
| Reeded | Gradient (shader) | A moving gradient seen through fluted glass ribs | Free |
| Nightbloom | Gradient (shader) | Slow magenta and ultraviolet blooms on deep violet, lots of black for type | Pro |
| Maelstrom | Swirl (shader) | A slow whirlpool from above, pulling toward a black eye | Free |
| Sunspot | Halftone (shader) | A retro sun in orange dots on cream paper, its halo pulsing | Free |
| Polarveil | Aurora (shader) | Green and violet curtains with fine rays over a starry sky | Free |
| Quicksilver | Liquid (shader) | Liquid chrome rolling and folding with hard highlights | Free |
| Hexpulse | Geometric (shader) | A dark honeycomb whose edges light up ring by ring from the centre | Free |
| Fireflies | Particles (shader) | Soft yellow-green lights wandering and blinking in a dark forest | Free |
| Morphsphere | 3D (shader) | A glossy ball that keeps melting into new shapes, with a bright rim light | Pro |
Which background suits your brand?
The family sets the mood before anyone reads a word, so match it to what the product feels like, not to what looks impressive in isolation. This is the shortlist we would start from for common kinds of site:
| Kind of site | Families that fit | Try first |
|---|---|---|
| SaaS and developer tools | Geometric, particles, calm gradients | Hexpulse, Reeded, Nimbus |
| AI products | 3D surfaces, aurora, dark gradients | Morphsphere, Nightbloom, Polarveil |
| Luxury, beauty, jewellery | Liquids, soft gradients | Quicksilver, Peachfuzz |
| Wellness and calm apps | Soft gradients, slow swirls, particles | Peachfuzz, Halo, Fireflies |
| Music, events, sport | Flames, swirls, halftones | Maelstrom, Sunspot |
| Editorial, publishing, studios | Halftones, engraved lines, fluted glass | Sunspot, Reeded |
| Travel and outdoors | Aurora, particles | Polarveil, Fireflies |
Light or dark?
Dark backgrounds make glowing motion look richer and hide compression artefacts, which is why most shader demos are dark. Light backgrounds feel calmer and more editorial but show banding more easily, so add a little grain. Pick the one that matches the rest of your site; a dark hero above a white page works only if the transition between them is designed.
How to keep text readable on a moving background
A beautiful background that makes the headline hard to read is a failed background. These rules keep it working:
- Leave a calm zone. Design the motion so the area behind the text is darker (or lighter) and slower than the edges. Nightbloom does this on purpose.
- Add a scrim when in doubt. A gradient from 70 percent page colour to transparent behind the text block fixes most contrast problems.
- Check contrast against the brightest frame, not the average one. Body text needs at least 4.5:1; large headlines at least 3:1.
- Slow it down behind words. Fast motion behind text tires the eye. A full loop of 10 to 20 seconds feels calm.
- Never animate text and background in the same direction at once. It reads as the text sliding.
How to add a WebGL shader background in Next.js
You do not need three.js for a full-screen background. One canvas, one triangle and one fragment shader are enough, and they cost a single draw call per frame. The component below is the pattern we use, simplified: it caps the pixel ratio, pauses when off-screen or when the tab is hidden, and draws a single still frame for people who prefer reduced motion. Put it in a client component and place it behind your hero with position: absolute; inset: 0.
'use client';
import { useEffect, useRef } from 'react';
const vertex = 'attribute vec2 p; void main() { gl_Position = vec4(p, 0.0, 1.0); }';
// Replace this with your own fragment shader. u_p runs from 0 to 1 over one loop.
const fragment = `precision highp float;
uniform vec2 u_res; uniform float u_p;
void main() {
vec2 uv = gl_FragCoord.xy / u_res;
float t = u_p * 6.2831853;
float glow = 0.5 + 0.5 * sin(uv.x * 3.0 + t) * cos(uv.y * 2.0 - t);
gl_FragColor = vec4(mix(vec3(0.05, 0.04, 0.09), vec3(0.95, 0.42, 0.29), glow * 0.6), 1.0);
}`;
export function ShaderBackground({ seconds = 12 }: { seconds?: number }) {
const ref = useRef<HTMLCanvasElement>(null);
useEffect(() => {
const canvas = ref.current!;
const gl = canvas.getContext('webgl', { antialias: false, alpha: false });
if (!gl) return; // the CSS background colour stays visible
const shader = (type: number, src: string) => {
const s = gl.createShader(type)!; gl.shaderSource(s, src); gl.compileShader(s); return s;
};
const program = gl.createProgram()!;
gl.attachShader(program, shader(gl.VERTEX_SHADER, vertex));
gl.attachShader(program, shader(gl.FRAGMENT_SHADER, fragment));
gl.linkProgram(program); gl.useProgram(program);
gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 3, -1, -1, 3]), gl.STATIC_DRAW);
gl.enableVertexAttribArray(0); gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
const res = gl.getUniformLocation(program, 'u_res');
const phase = gl.getUniformLocation(program, 'u_p');
const resize = () => {
const dpr = Math.min(window.devicePixelRatio || 1, 1.5); // cap the pixel ratio
canvas.width = Math.round(canvas.clientWidth * dpr);
canvas.height = Math.round(canvas.clientHeight * dpr);
gl.viewport(0, 0, canvas.width, canvas.height);
gl.uniform2f(res, canvas.width, canvas.height);
};
const draw = (time: number) => {
gl.uniform1f(phase, (time / 1000 / seconds) % 1);
gl.drawArrays(gl.TRIANGLES, 0, 3);
};
const still = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
let frame = 0, visible = true;
const loop = (time: number) => { draw(time); frame = requestAnimationFrame(loop); };
const start = () => { if (!frame && visible && !document.hidden && !still) frame = requestAnimationFrame(loop); };
const stop = () => { cancelAnimationFrame(frame); frame = 0; };
resize(); draw(0); start();
const observer = new IntersectionObserver(([entry]) => { visible = entry.isIntersecting; visible ? start() : stop(); });
observer.observe(canvas);
const onVisibility = () => (document.hidden ? stop() : start());
document.addEventListener('visibilitychange', onVisibility);
window.addEventListener('resize', resize);
return () => { stop(); observer.disconnect(); document.removeEventListener('visibilitychange', onVisibility); window.removeEventListener('resize', resize); };
}, [seconds]);
return <canvas ref={ref} aria-hidden="true" style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', background: '#0d0a17' }} />;
}Or skip JavaScript: a pure CSS animated gradient
If the background only needs to drift and glow, CSS is lighter still. Blurred radial gradients on a pseudo-element, moved with a slow keyframe, give a convincing mesh gradient with no script at all. This is the same idea as Nimbus, in its simplest form:
.hero { position: relative; overflow: hidden; background: #0b0b0e; isolation: isolate; }
.hero::before {
content: ''; position: absolute; inset: -20%; z-index: -1;
background:
radial-gradient(40% 50% at 20% 30%, #ff6b4a99, transparent 70%),
radial-gradient(35% 45% at 80% 20%, #7a5cff88, transparent 70%),
radial-gradient(45% 55% at 60% 80%, #00c2a877, transparent 70%);
filter: blur(40px);
animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate3d(4%, -3%, 0) rotate(8deg) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .hero::before { animation: none; } }Performance checklist for animated backgrounds
Run through this before you ship. Every item is cheap to do and each one prevents a common complaint.
- Cap the device pixel ratio at 1.5 or 2. Rendering a full-screen shader at 3x on a phone costs four times the work of 1.5x and looks the same behind text.
- Pause when off-screen with an IntersectionObserver, and when the tab is hidden.
- Draw one still frame for reduced motion, or show the poster image instead of the canvas.
- Do not block the first paint. Give the canvas a CSS background colour that matches the first frame, so nothing flashes while WebGL starts.
- One background per page. Two full-screen shaders running at once doubles GPU work for no visual gain.
- Use the MP4 loop where code is awkward, for example in an email, a slide deck or a page builder that blocks custom scripts.
- Test on a mid-range phone, not only your laptop. If the fans spin on a laptop, a phone will drop frames.
Prompting an AI tool for an animated background
AI tools write decent shaders when the prompt is specific about the look, the loop and the limits. Vague prompts ("cool animated background") get the same purple gradient every time. A good prompt names the family, the colours, the speed, the interaction and the performance rules. For example:
Full-viewport animated background behind the hero, drawn with raw WebGL 1 on one canvas, no libraries.
Look: slow aurora curtains in #2de3a5 and #7c5cff over a near-black sky #05060a, fine vertical rays.
Loop: seamless 12-second loop driven by a phase uniform from 0 to 1. Pointer leans the curtains slightly (eased).
Readability: keep the lower-left third darker and calmer; the headline sits there.
Performance: cap devicePixelRatio at 1.5, pause when off-screen or the tab is hidden.
Reduced motion: render one still frame. Fallback: CSS background #05060a if WebGL is unavailable.Where to find ready-made background prompts
Every background in the BuildMotions library has a prompt written for six AI tools, which includes its exact fragment shader so the tool does not have to invent one. Browse them by family in background prompts or animated background templates, and read about the technique in WebGL shader animations.
Free and paid backgrounds
Many of the 50 backgrounds are free, including Nimbus, Halo, Peachfuzz, Reeded, Maelstrom, Sunspot, Polarveil, Quicksilver, Hexpulse and Fireflies, so you can use one on your next landing page today. A paid plan unlocks every Pro background and every other template in the library, all Pro prompts for six AI tools, the preview films and stills, client-project use and the runnable Next.js source code. See the pricing page for the details of each plan.
Backgrounds are often the first thing people take from the library and the hero templates are the second. If you expect to keep coming back, Lifetime is the plan that makes sense: $149 once at launch instead of the regular $499, every future template and background included, no renewal, and a licence for personal and client projects that does not expire.
