INTERACTION_015CSS + JS
Scroll Reveal
Content fades and rises as it enters the viewport.
Scroll / LightView
Three layers move at different speeds to build depth. Aligned at their resting offsets before the trigger; translating layers at 0.1, 0.25 and 0.45 of the scroll delta once scroll position relative to the section.
/* Depth Parallax — Three layers move at different speeds to build depth. */
.depth-parallax {
--dur: scroll-linked;
--ease: linear;
--stagger: 60ms;
will-change: transform, opacity;
}
.depth-parallax > * {
opacity: 0;
transform: translateY(14px);
animation: depth-parallax-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* aligned at their resting offsets -> translating layers at 0.1, 0.25 and 0.45 of the scroll delta */
@keyframes depth-parallax-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.depth-parallax > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Depth Parallax — trigger: scroll position relative to the section */
export function DepthParallax({ 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="depth-parallax" data-state="out">
{children}
</div>
);
}Content fades and rises as it enters the viewport.
Children enter in sequence with a fixed delay step.
Page surfaces shift tone as each section takes over.