INTERACTION_077CSS
Paragraph Masking
A paragraph is revealed behind a soft gradient mask as it enters.
Copy / LightView
Sentences brighten in turn so attention moves down the block. Every sentence at 30% opacity before the trigger; raising each sentence to full opacity as it reaches the reading line once scroll progress through the block.
/* Sentence Opacity Progression — Sentences brighten in turn so attention moves down the block. */
.sentence-opacity-progression {
--dur: scroll-linked;
--ease: linear;
--stagger: 60ms;
will-change: transform, opacity;
}
.sentence-opacity-progression > * {
opacity: 0;
transform: translateY(14px);
animation: sentence-opacity-progression-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* every sentence at 30% opacity -> raising each sentence to full opacity as it reaches the reading line */
@keyframes sentence-opacity-progression-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.sentence-opacity-progression > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Sentence Opacity Progression — trigger: scroll progress through the block */
export function SentenceOpacityProgression({ 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="sentence-opacity-progression" data-state="out">
{children}
</div>
);
}A paragraph is revealed behind a soft gradient mask as it enters.
Extra detail expands smoothly without a jump in layout.
A thin progress rule tracks how far the reader has moved.
Individual words light up as the scroll line passes through them.