Motion

We have prepared custom motion variables that give every animation and transition the same timing, from a hover to a dialog.

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 VariableDefault ValuePurpose
--wp--custom--motion--duration--fast200msHover and focus; closing a panel, a menu or an accordion
--wp--custom--motion--duration--base350msOpening a panel, a menu or an accordion; content fading in place; closing a modal dialog or a drawer
--wp--custom--motion--duration--slow500msOpening a modal dialog or a drawer
--wp--custom--motion--easing--standardcubic-bezier(.2, 0, 0, 1)Changes in place: colors and fades
--wp--custom--motion--easing--entercubic-bezier(0, 0, .58, 1)Everything that comes in: it slows down
--wp--custom--motion--easing--exitcubic-bezier(.3, 0, 1, 1)Everything that leaves: it speeds up
--wp--custom--motion--distance--small.5remHow far a panel moves as it comes in: sub-menus, Mega Menu panels, a search, a non-modal dialog, back to top
--wp--custom--motion--distance--base1remHow far a modal dialog at the side of the window moves as it comes in
--wp--custom--motion--scale--enter.95The size a dialog in the center of the window grows from
--wp--custom--motion--stagger80msThe 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.