This is a per-letter reveal animation I built entirely with CSS - no JavaScript timing loop, no animation library, one custom property driving all of it.
Staggering the letters of a text is a simple, well-used animation. Its job is to show the user where the text comes from and which direction the page is moving in. The full code is at the end.
What went wrong first
My first version wrapped each letter in JavaScript and set every delay by hand. It worked, but it felt hacky. Then I found out that an index can be passed through a CSS variable, and the whole effect moved into CSS.
The CSS-only version
Each letter gets its own --index, set inline via style={{ '--index': i }} on the span. That value feeds animation-delay: calc(var(--stagger) * var(--index)), so instead of every letter starting at once, each one waits a little longer than the last - at the 0.03s stagger it ships with, letter 0 starts immediately and letter 9 starts 270ms later. That's what gives you the cascade instead of a flat pop-in.
One detail I almost missed: animation-fill-mode: backwards1. Without it, every letter flashes into its final position for a frame before its delay kicks in, which looks broken. With backwards, each letter just holds still - translated out of view - until its turn comes up. The easing, a cubic-bezier(.075, .82, .165, 1) curve2, slows down hard right at the end so it settles instead of overshooting and bouncing.
It also respects prefers-reduced-motion - if you've told your OS you'd rather skip animations, you just get the final text straight away, no cascade, no fuss.
If you're about to build one
This effect is mostly aesthetics, and with motion, less is better: when everything animates, the user's attention goes to the movement and not to the action or the content they came for. Motion should guide the eye to what matters - not become the thing to look at. A button that out-animates its own label isn't much help, is it? Staggering every item in a menu, for example, gets annoying fast.
The code
LetterCascade.tsx
import styles from './styles.module.css'const TEXT = 'Animations'export function LetterCascade() {return (<h1 aria-label={TEXT} className={styles.h1}>{[...TEXT].map((letter, index) => (<spanaria-hidden={'true'}key={`${index}-${letter}`}className={styles.letter}style={{ '--index': index }}>{letter}</span>))}</h1>)}
styles.module.css
References
- 1.animation-fill-mode · CSS · MDN
- 2.easing-function · CSS · MDN