INTERACTION_152CSS
Grid Distortion
A technical grid bends gently around a moving focus point.
Background / MediumView
A perspective wireframe plane recedes into the distance. The plane at its start offset before the trigger; translating the plane along the Z axis and looping seamlessly once in view, looping.
/* 3D Wireframe — A perspective wireframe plane recedes into the distance. */
.wireframe-3d {
--dur: 9s;
--ease: linear;
--stagger: 60ms;
will-change: transform, opacity;
}
.wireframe-3d > * {
opacity: 0;
transform: translateY(14px);
animation: wireframe-3d-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* the plane at its start offset -> translating the plane along the Z axis and looping seamlessly */
@keyframes wireframe-3d-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.wireframe-3d > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** 3D Wireframe — trigger: in view, looping */
export function 3DWireframe({ 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="wireframe-3d" data-state="out">
{children}
</div>
);
}A technical grid bends gently around a moving focus point.
Layers drift at different depths as the pointer moves.