LOVABLECURSORBOLTV0REPLITWINDSURFLOVABLECURSORBOLTV0REPLITWINDSURF
Back to library
INTERACTION_157
Radial Glow.
A single ambient glow breathes behind the hero content. At 70% opacity and scale 1 before the trigger; easing opacity and scale up and back once in view, looping every 8 seconds.
- CATEGORY
- Background
- COMPLEXITY
- Easy
- TECH
- CSS
- PLATFORM
- Both
- PERFORMANCE
- Light
LIVE PLAYGROUND
CSS / CSS
/* Radial Glow — A single ambient glow breathes behind the hero content. */
.radial-glow {
--dur: 8s;
--ease: ease-in-out;
--stagger: 60ms;
will-change: transform, opacity;
}
.radial-glow > * {
opacity: 0;
transform: translateY(14px);
animation: radial-glow-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* at 70% opacity and scale 1 -> easing opacity and scale up and back */
@keyframes radial-glow-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.radial-glow > * {
opacity: 1;
transform: none;
animation: none;
}
}React / TSX
import { useEffect, useRef } from "react";
/** Radial Glow — trigger: in view, looping every 8 seconds */
export function RadialGlow({ children }: { children: React.ReactNode }) {
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
const el = ref.current;
if (!el) return;
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
el.dataset["state"] = "in";
return;
}
const io = new IntersectionObserver(
([entry]) => {
if (entry?.isIntersecting) {
el.dataset["state"] = "in";
io.unobserve(el);
}
},
{ threshold: 0.2 },
);
io.observe(el);
return () => io.disconnect();
}, []);
return (
<div ref={ref} className="radial-glow" data-state="out">
{children}
</div>
);
}IF YOU LIKE THIS, STEAL THESE TOO.
STRUCTURE / 56PX
TEXTURE / 3%
INTERACTION_147CSS
Gradient Mesh
Soft overlapping gradients drift behind the content.
Background / MediumView