Skip to content

No.300 · Text Animations

Word Carousel

A headline with a rotating word, done with care: the outgoing word lifts away letter by letter into a blur, the next rises into focus, and the slot springs to its new width so the sentence never jumps. Each word brings its own colours and a soft light beneath it.

The prompt

The design brief behind this component — reuse it to regenerate, remix, or explain it.

Build a hero headline "Plan trips for [word]" where the word cycles through a list (your family / the whole team / just two / a long weekend), each with its own two-colour gradient. Slot: an inline-block that holds the word, its width set to the measured width of the current word (every word is measured once in an invisible copy at the same size, re-measured on resize and fonts.ready) with a springy transition (640ms, cubic-bezier(.32,1.32,.46,1)), so the sentence reflows smoothly instead of jumping. perspective 700px. Letters: one inline-block span per character (spaces as nbsp), coloured by color-mix(in oklch, from, to t%) along the word. Incoming letters animate from translateY(.5em) rotateX(−72°) scale(.96) blur(10px) opacity 0 to rest (720ms, ease-out, 30ms stagger); outgoing letters go to translateY(−.42em) rotateX(55°) blur(8px) opacity 0 (460ms, ease-in, 18ms stagger) and overlap the incoming ones in the same absolutely positioned slot. Clock: a 2px gradient hairline under the word scales 0 → 1 over the interval (CSS animation); its animationend advances to the next word, so pausing is just animation-play-state: paused — on hover, focus, offscreen (IntersectionObserver) or the Pause button. A blurred radial glow in the word's colours sits behind it and transitions with each word. Accessibility: the animated text is aria-hidden; a visually hidden sentence lists every option ("Plan trips for your family, the whole team, just two, or a long weekend."). Reduced motion swaps words without movement on a slower clock. Themes: night and paper (deeper gradients).

Notes

Interaction
Hover or focus to hold the current word; Pause stops the rotation.
Motion
In 720ms (30ms stagger), out 460ms (18ms stagger), width spring 640ms; dwell 2.6s.
Accessibility
Screen readers get one static sentence with all the options; the motion is aria-hidden and pausable (WCAG 2.2.2).
Responsive
Type is fluid (clamp(2.3rem, 7.4vw, 5.6rem)); the slot is inline, so on narrow screens it wraps under the prefix.
On touch
Tap Pause to hold a word.

Featured

301 components