Motion

Easing and duration tokens for your transitions and animations.

Easing

-out for entering, -in for leaving, -in-out for moving on screen, -linear for continuous motion.

--wr-ease-linear
--wr-ease-out
--wr-ease-in
--wr-ease-in-out
--wr-ease-spring
TokenValueUse
--wr-ease-linearlinearProgress bars, spinners, marquees
--wr-ease-outcubic-bezier(0.16, 1, 0.3, 1)Entering
--wr-ease-incubic-bezier(0.7, 0, 0.84, 0)Leaving
--wr-ease-in-outcubic-bezier(0.65, 0, 0.35, 1)Moving between two states
--wr-ease-springcubic-bezier(0.34, 1.56, 0.64, 1)Overshoot. Use sparingly

Durations

The farther something moves, the longer it may take.

TokenValueUse
--wr-duration-fast0.1sHover and focus feedback
--wr-duration-base0.15sState changes: pressed, checked, selected
--wr-duration-slow0.3sTravel: a drawer, an expanding panel
--wr-duration-slower0.5sFull-screen motion

Shorthands

A duration and an easing in one token. You name the property.

TokenValue
--wr-transition-shortvar(--wr-duration-fast) var(--wr-ease-out)
--wr-transition-basevar(--wr-duration-base) var(--wr-ease-linear)
--wr-transition-longvar(--wr-duration-slow) var(--wr-ease-out)

Overlay timing

Dropdown, popover, tooltip, context menu and popconfirm read these; dialog, drawer and toast do not.

TokenValue
--wr-overlay-durationvar(--wr-duration-base)
--wr-overlay-easevar(--wr-ease-out)

Usage

.my-control {
  transition: background-color var(--wr-transition-base);
}

.my-drawer {
  transition: transform var(--wr-duration-slow) var(--wr-ease-out);
}

// Retune everything that reads the tokens
:root {
  --wr-duration-base: 0.08s;
  --wr-overlay-ease: var(--wr-ease-spring);
}

Reduced motion

The theme stops overlay enter animations; zero the durations to stop transitions too.

@media (prefers-reduced-motion: reduce) {
  :root {
    --wr-duration-fast: 0.01ms;
    --wr-duration-base: 0.01ms;
    --wr-duration-slow: 0.01ms;
    --wr-duration-slower: 0.01ms;
    --wr-overlay-duration: 0.01ms;
  }
}

The theme's own reduced-motion rules are !important, so an override of them has to be too.

See also