Scroll text reveal
Also called text reveal, word-by-word scroll reveal, or scroll text highlight
A paragraph whose words brighten from faint to full one by one as you scroll through it, tied to the scroll position so it rewinds on the way up.
import { useRef } from 'react';
import {
motion,
useReducedMotion,
useScroll,
useTransform,
type MotionValue
} from 'motion/react';
export function TextReveal({ text }: { text: string }) {
const ref = useRef<HTMLElement>(null);
const reduceMotion = useReducedMotion();
// 0 when the section's top reaches the top of the viewport, 1 when its
// bottom reaches the bottom: the whole time the paragraph is pinned.
const { scrollYProgress } = useScroll({
target: ref,
offset: ['start start', 'end end']
});
const words = text.split(' ');
return (
<section ref={ref} className='relative h-[300vh]'>
<div className='sticky top-0 flex h-screen items-center px-6'>
<p className='mx-auto max-w-3xl text-4xl font-semibold tracking-tight'>
{reduceMotion ? (
text
) : (
<>
{/* Screen readers get the sentence once, not word by word. */}
<span className='sr-only'>{text}</span>
<span aria-hidden>
{words.map((word, index) => (
<Word
key={index}
progress={scrollYProgress}
range={[index / words.length, (index + 1) / words.length]}
>
{word}
</Word>
))}
</span>
</>
)}
</p>
</div>
</section>
);
}
function Word({
children,
progress,
range
}: {
children: string;
progress: MotionValue<number>;
range: [number, number];
}) {
// Each word owns one slice of the scroll and brightens across it.
const opacity = useTransform(progress, range, [0.18, 1]);
return <motion.span style={{ opacity }}>{children} </motion.span>;
}Add a scroll text reveal to the mission section: a 300vh-tall section with a sticky, vertically centered paragraph in 40px semibold type. Split the text into words, start each word at 18% opacity, and raise each one to 100% in reading order as the section scrolls past, tied directly to scroll position so it reverses when scrolling up. Use Motion’s useScroll and useTransform, keep the full sentence available to screen readers, and show it at full opacity when prefers-reduced-motion is set.
Paste into Layerwise or any AI coding tool.
What is Scroll text reveal?
A scroll text reveal splits a paragraph into words and shows them all faint, around 15 to 20% opacity. As the reader scrolls, the words light up in reading order, as if the page were reading along. Each word’s opacity follows the scroll position, so scrolling back up dims the words again.
The usual build pins the paragraph with position: sticky inside a section two to four screens tall. Motion’s useScroll reads that section’s progress from 0 to 1, and useTransform gives each word its own slice: word 5 of 20 brightens between 0.25 and 0.30. Overlapping the slices a little makes a softer wave. In browsers that support it, CSS can do the same with animation-timeline: view() on each word.
Save it for one short statement, such as a mission line, a product promise, or a quote; a long paragraph makes people scroll a lot for a little. Keep the faint words readable, give screen readers the full sentence once and hide the split copy with aria-hidden, and show the text at full opacity for people who prefer reduced motion.
Often confused with
- Scroll reveal
- A scroll reveal plays a one-time entrance when an element enters the viewport. A scroll text reveal follows the scroll position word by word and rewinds when you scroll back.
- Split text animation
- Split text animates letters or words in on a timer, usually once. A scroll text reveal uses the same split, but the scroll position decides how far along each word is.
Related terms
All termsScroll-driven animation
An animation whose progress is tied directly to the scroll position, so it moves forward as you scroll down and rewinds as you scroll up.
Split text animation
A text animation that breaks a heading into characters, words, or lines and animates each piece in turn, so the text arrives as a wave.
Scroll pinning
A scroll effect that holds a section in place while its content animates through several states, then releases it to scroll away.
Scrollytelling
A storytelling layout where a pinned graphic changes step by step as the reader scrolls through short blocks of text beside it.
Build it with Layerwise
Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.