---
name: text-effects
description: Use when animating text and numbers, such as rolling counters, word-by-word reveals, typewriter effects, shimmering labels and handwriting.
---

# Text and number effects

Text motion should make reading easier, not harder. Keep it short and never animate long paragraphs letter by letter.

## Numbers

- Roll digits vertically instead of fading whole numbers; each digit is a column of 0-9 that translates.
- Keep `font-variant-numeric: tabular-nums` so the width does not jump.
- Animate commas, signs and currency symbols separately with a short slide.
- Duration 400-700ms with a soft overshoot; shorter for small changes.
- SwiftUI: `.contentTransition(.numericText())`.

## Headings

- Reveal by word, not by letter: each word rises 8-12px with `blur(6px)` to `blur(0)`, staggered 40-60ms.
- Mask each line (`overflow: hidden`) for a clean slide-up reveal.
- Run it once when the heading enters the viewport.

## Labels that change

- Vertical roll: old label exits up, new label enters from below, about 200ms.
- Keep the container width animated (layout animation) so neighbours do not jump.

## Typewriter and streaming text

- Reveal by chunks of 2-4 characters every 16-30ms; show a blinking caret.
- Let users skip the animation by clicking.

## Shimmer ("Thinking…")

```css
.shimmer {
  background: linear-gradient(90deg, #9ca3af 0%, #111 50%, #9ca3af 100%) 0 0 / 200% 100%;
  -webkit-background-clip: text;
  color: transparent;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
```

## Rules

- Screen readers must get the final text immediately (`aria-label` or visually hidden text).
- Reduced motion: show final text and numbers instantly.
