Usage
Every animation and transition of the Custom theme, and the related plugins, takes its timing from custom motion variables. The Core theme has no motion. Custom motion variables are set in theme.json and can be overwritten with CSS in the Site Editor or in the codebase.
| CSS Variable | Default Value | Purpose |
|---|---|---|
--wp--custom--motion--duration--fast | 200ms | Hover and focus; closing a panel, a menu or an accordion |
| 350ms | Opening a panel, a menu or an accordion; content fading in place; closing a modal dialog or a drawer |
| 500ms | Opening a modal dialog or a drawer |
| cubic-bezier(.2, 0, 0, 1) | Changes in place: colors and fades |
| cubic-bezier(0, 0, .58, 1) | Everything that comes in: it slows down |
| cubic-bezier(.3, 0, 1, 1) | Everything that leaves: it speeds up |
| .5rem | How far a panel moves as it comes in: sub-menus, Mega Menu panels, a search, a non-modal dialog, back to top |
| 1rem | How far a modal dialog at the side of the window moves as it comes in |
| .95 | The size a dialog in the center of the window grows from |
| 80ms | The time between menu items that appear one after the other |
- Motion follows where something comes from. A panel below its button comes from above, a drawer from its edge of the window, a dialog in the center grows, and items appear in reading order.
- Closing is quicker than opening. What comes in slows down, what leaves speeds up.
- Reduced motion keeps every change visible. When a visitor asks their system to reduce motion, nothing moves and the fades remain.
- The focus outline appears at once. It is never animated, and icons swap without turning.