# Kinetic Typography

[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/kinetic-typography/)

## What it is
Kinetic typography is text in motion, where the way each word moves matches what it means. A short sequence shows one phrase at a time, and each phrase gets its own way in and out: a heavy word can drop in large, a soft word can simply fade. It comes from film titles and motion graphics, where moving words tell a story on their own.

## When to use it
- Opening sequences and splash screens where brand personality is established
- Video-style storytelling sections on marketing sites
- Presentation slides that need to feel like motion graphics
- App onboarding flows where each step has a narrative beat
- Anywhere the text itself is the content, not a label for something else

## How it works
Each phrase is a CSS element with an entry animation, a hold period, and an exit animation. A JavaScript timeline chains them with `setTimeout`:

```js
const PHRASES = [
  { text: 'EVERY',  enter: 'enter-scale', exit: 'exit-up',    hold: 1400 },
  { text: 'MOMENT', enter: 'enter-big',   exit: 'exit-shrink', hold: 1800 },
];

function showPhrase(i) {
  const p = PHRASES[i];
  el.textContent = p.text;
  el.className = p.enter; // triggers @keyframes
}

function run(idx = 0) {
  showPhrase(idx);
  const last = idx === PHRASES.length - 1;
  if (last && !loop) return;               // the final phrase stays on screen
  setTimeout(() => {
    exitPhrase(idx, () => run((idx + 1) % PHRASES.length));
  }, ENTER_DUR + PHRASES[idx].hold);
}
```

Each enter and exit is a standalone `@keyframes` rule:

```css
.enter-scale { animation: kEnterScale 600ms ease-out forwards; }
.exit-up     { animation: kExitUp     400ms ease-in  forwards; }

@keyframes kEnterScale { from { opacity:0; transform:scale(.5) } to { opacity:1; transform:scale(1) } }
@keyframes kExitUp     { from { opacity:1; transform:translateY(0) } to { opacity:0; transform:translateY(-50px) } }
```

The Speed setting is a CSS custom property used in every `calc()`; the timers divide by the same value:

```css
.enter-scale { animation-duration: calc(600ms / var(--spd)); }
```

## Key parameters
| Parameter | Default | Effect |
|-----------|---------|--------|
| Speed | Normal | The pace of the whole sequence: slow plays it at 0.6× speed, normal at 1× and fast at 1.7×; entrances, holds and exits all scale together, and at normal entrances take 400 to 700ms, holds 0.9 to 2.2 seconds and exits 300 to 500ms |

## Production notes
- **Copy-first choreography**: the motion should be chosen for the words, not the other way around. Soft/gentle words dissolve; heavy words slam in; fragile words flutter. Generic enters and exits applied uniformly undermine the whole technique.
- **Hold duration is critical**: reading speed for subtitles is roughly 200ms per word minimum. A 3-word phrase needs at least 600ms of hold, ideally 1000ms+. The most common mistake is holding too briefly.
- **Audio sync**: kinetic typography originated in sound-synced broadcast. Even on web (without audio), timing phrases to a mental beat makes sequences feel more intentional. Think in measures, not just milliseconds.
- **CSS vs canvas**: CSS `@keyframes` is sufficient for most web uses. For audio-synced or highly complex sequences, GSAP's timeline API (`gsap.timeline()`) is the production-grade choice. Lottie (JSON-based After Effects export) handles pre-rendered kinetic sequences that are too complex for CSS.
- **`prefers-reduced-motion`**: show all phrases simultaneously or show only the final phrase — don't suppress the text itself.

## See also
- [Enter/Exit Typography](../enter-exit-typography/) — each phrase comes in, holds and leaves
- [Rotate Word Carousel](../rotate-word-carousel/) — one word in a sentence keeps changing
- [Text Clip-Path Reveal](../text-clip-path-reveal/) — lines of text are uncovered one by one
