Overview
This code snippet creates a word carousel where a rotating set of words smoothly crossfade with blur effects. It maintains a stable layout width and demonstrates elegant multi-word animations perfect for hero sections or taglines.Complete Code
What This Snippet Demonstrates
Stable Layout Width
Stable Layout Width
Uses an invisible “width keeper” element set to the longest word, preventing layout shifts during word transitions.
Smooth Crossfade
Smooth Crossfade
During transitions, both words render simultaneously with inverse opacity, creating a seamless blend without gaps.
Blur Transitions
Blur Transitions
Applies blur to outgoing words (increasing) and incoming words (decreasing) for a dreamy, cinematic effect.
Hold and Flip Phases
Hold and Flip Phases
Divides each word cycle into a “hold” phase (word visible at full opacity) and “flip” phase (crossfade transition).
Key Concepts
Phase-Based Animation:alignItems: "baseline" ensures the prefix and rotating word sit on the same text baseline.
When to Use This Pattern
- Hero sections with rotating taglines (e.g., “Built for X”)
- Product feature highlights with multiple audiences
- Mission statements with multiple values
- Call-to-action banners with rotating benefits
- Header animations for landing pages
Customization Tips
- Timing
- Effects
- Words
- Style
Adjust
HOLD_DURATION (how long each word displays) and FLIP_DURATION (transition speed). Try 40/15 for slower, punchier transitions.The invisible width keeper ensures the layout doesn’t shift when words change. If you want centered text without this, use
textAlign: "center" and accept slight horizontal movement.This pattern works well with 4-8 words. For longer lists, consider grouping related words or using a different transition style to maintain viewer engagement.