Lava background
plugins/ui-shared/main.js · style.cssTen blurred blobs drift behind every modal. There is no canvas and no image: the whole effect is one container with a big filter: blur() and ten elements with radial gradients, each moving on its own schedule.
Ten blobs, one container
The blur is applied to the parent, not to each blob. That matters: blurring ten separate elements means ten filter passes, while a single filter on the container blurs the already-composited result — one pass for the whole layer.
.modal-lava {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
filter: blur(300px) saturate(2);
}
.lava-blob {
position: absolute;
will-change: transform; /* transform only — the cheapest layer */
}
What a blob is
Each blob is a circle filled with a radial gradient that fades into the base colour, so the edges never look like edges after the blur. Sizes and positions are fixed per index, which is why the picture is stable between reloads.
.lava-blob--4 {
width: 400px;
height: 400px;
top: 15%;
left: 60%;
background: radial-gradient(
circle at 30% 40%,
var(--lava-color-middle-3) 0%,
var(--lava-color-light-2) 70%,
transparent 100%
);
animation: lavaFloat4 22s ease-in-out infinite alternate;
}
Motion
Every keyframe set has three states: the start, a scaled-up move in one direction, and a scaled-down move in another. Because the animation is alternate, it plays forward and back, so the loop has no visible seam.
@keyframes lavaFloat4 {
0% { transform: translate(0, 0) scale(1); }
50% { transform: translate(-80px, 140px) scale(1.2); }
100% { transform: translate(60px, -40px) scale(.95); }
}
Where it is created
Modals do not repeat the markup in HTML — the background is built in JS, so a new dialog gets the effect for free.
export function createModal(options = {}) {
const modal = document.createElement('div');
modal.className = 'modal-root';
const content = document.createElement('div');
content.className = 'modal-content';
const lava = document.createElement('div');
lava.className = 'modal-lava';
for (let i = 1; i <= 10; i++) {
const blob = document.createElement('div');
blob.className = `lava-blob lava-blob--${i}`;
lava.appendChild(blob);
}
content.appendChild(lava);
// ... close button, reminder, the actual content ...
}
Cost and the reduced-motion case
- A 300px blur over a full-screen layer is expensive on integrated GPUs, so on narrow screens the radius is lowered — the effect survives, the frame time does not suffer.
will-change: transformkeeps each blob on its own compositing layer, so the animation does not repaint the gradient.- Under
prefers-reduced-motion: reducethe animations are switched off completely and the blobs stay static.
@media (prefers-reduced-motion: reduce) {
.lava-blob { animation: none; }
}