Overview
This code snippet creates a text rotation animation where words fade in, hold, then dissolve out with blur and scale effects. Each word cycles through smoothly, creating an elegant presentation for multi-message animations.Complete Code
What This Snippet Demonstrates
Multi-Stage Interpolation
Multi-Stage Interpolation
Uses
interpolate() with 4 keyframes to create complex fade-in, hold, fade-out sequences with precise timing control.Blur Transitions
Blur Transitions
Applies blur during entrance and exit for a dreamy, cinematic dissolve effect instead of a simple opacity fade.
Scale Animation
Scale Animation
Combines scale with opacity and blur—words start small (0.8), normalize to 1.0, then expand (1.2) as they exit.
Cycling Logic
Cycling Logic
Uses modulo (
%) arithmetic to loop through words indefinitely, perfect for continuous playback.Key Concepts
Frame-Based Timing: Each word occupiesWORD_DURATION frames, with frameInWord tracking position within the current word’s cycle.
Interpolation Keyframes: The pattern [0, 15, 45, 60] creates:
- 0-15: Fade in with blur and scale
- 15-45: Hold at full opacity, normal scale, no blur
- 45-60: Fade out with blur and expanding scale
Math.floor(frame / WORD_DURATION) % WORDS.length ensures words cycle endlessly without manual looping.
When to Use This Pattern
- Tagline presentations with multiple messages
- Product feature highlights (e.g., “Fast”, “Secure”, “Reliable”)
- Brand value statements
- Quote rotations
- Transition slides between sections
Customization Tips
- Timing
- Effects
- Visual Style
- Words
Adjust
WORD_DURATION (total frames per word), FADE_IN_DURATION (entrance speed), and FADE_OUT_START (when exit begins).For more variation, you can randomize scale or blur amounts per word, or add rotation (
rotateZ) to the transform for dynamic angles.