Foundations
Motion
Duration and easing tokens for restrained interaction feedback.
Motion supports state changes and never delays the user. Durations are short and easing is predictable.
Durations#
Duration tokens
| Token | Value |
|---|---|
--ok-duration-fast | 120ms |
--ok-duration-instant | 60ms |
--ok-duration-normal | 180ms |
--ok-duration-slow | 280ms |
Easing#
Easing tokens
| Token | Value |
|---|---|
--ok-ease-emphasized | cubic-bezier(0.16, 1, 0.3, 1) |
--ok-ease-exit | cubic-bezier(0.4, 0, 1, 1) |
--ok-ease-standard | cubic-bezier(0.2, 0, 0, 1) |
Use the standard easing for most state transitions. The emphasized curve is suitable for small entrances such as an overlay or popover.
Reduced motion#
The base stylesheet collapses all duration tokens to 0ms when the user prefers reduced motion:
@media (prefers-reduced-motion: reduce) {
:root {
--ok-duration-instant: 0ms;
--ok-duration-fast: 0ms;
--ok-duration-normal: 0ms;
--ok-duration-slow: 0ms;
}
}Components that animate should use these tokens rather than hard-coded durations.
.button {
transition:
background-color var(--ok-duration-fast) var(--ok-ease-standard),
border-color var(--ok-duration-fast) var(--ok-ease-standard);
}