Motion
Durations chosen by what moves, four easing curves, one way for every surface to appear, nothing that moves as the page loads, and reduced motion from the person's setting or the app's own.
Motion in Tanrei shows what changed, and is over quickly. Every component already moves by the motion tokens, so a product that only uses the components sets nothing. This page says what the tokens are, what the components do with them, and what you can rely on.
How long a change takes depends on what moves — its role — not on a step picked from a scale. A change of state of a small control, a selection mark, a box that resizes, a menu that appears: each is a role under tanrei.sys.motion.role, and every component of one role keeps one pace. A surface leaves faster than it appears.
| Token | Value | Preview |
|---|---|---|
--tanrei-sys-motion-role-appear-anchored-enter | 300ms | |
--tanrei-sys-motion-role-appear-anchored-exit | 250ms | |
--tanrei-sys-motion-role-appear-hint-enter | 250ms | |
--tanrei-sys-motion-role-appear-hint-exit | 200ms | |
--tanrei-sys-motion-role-appear-modal-enter | 350ms | |
--tanrei-sys-motion-role-appear-modal-exit | 300ms | |
--tanrei-sys-motion-role-appear-sheet-enter | 400ms | |
--tanrei-sys-motion-role-appear-sheet-exit | 350ms | |
--tanrei-sys-motion-role-appear-toast-enter | 350ms | |
--tanrei-sys-motion-role-appear-toast-exit | 300ms | |
--tanrei-sys-motion-role-disclosure | 400ms | |
--tanrei-sys-motion-role-feedback | 450ms | |
--tanrei-sys-motion-role-reduced | 100ms | |
--tanrei-sys-motion-role-resize-default | 300ms | |
--tanrei-sys-motion-role-resize-large | 400ms | |
--tanrei-sys-motion-role-selection-mark | 250ms | |
--tanrei-sys-motion-role-selection-travel | 250ms | |
--tanrei-sys-motion-role-show-delay | 300ms | |
--tanrei-sys-motion-role-state-compact | 200ms | |
--tanrei-sys-motion-role-state-default | 250ms | |
--tanrei-sys-motion-role-state-large | 250ms |
Generated from design/tokens/tanrei.light.tokens.json, tokens/sys/motion.tokens.json
A component’s own duration token aliases its role: tanrei.comp.menu.motion.open-duration is tanrei.sys.motion.role.appear.anchored.enter. So a layer re-times every component of one role in one line:
"tokens": {
"tanrei.sys.motion.role.appear.anchored.enter": { "$value": "{tanrei.sys.motion.duration.medium1}", "reason": "Our menus open quickly." }
}The roles follow the motion dial, dial.motion.unit, which re-times every duration at once (Design systems). What no role describes keeps a step of the duration scale: a cycle (a loading indicator’s turn, a skeleton’s pulse), a progress bar moving to its value, a scroll, and a wait such as a delay.
Four curves by role, each pointing to a curve of the scale: enter for a surface that appears, exit for one that leaves, state for a change of state in place, and spatial for something that moves or resizes in place. In the default system enter, state and spatial are the standard curve; exit accelerates, so a leaving surface gathers speed and is gone.
| Token | Value | Curve |
|---|---|---|
--tanrei-sys-motion-easing-emphasized-accelerate | cubic-bezier(0.3, 0, 0.8, 0.15) | |
--tanrei-sys-motion-easing-emphasized-decelerate | cubic-bezier(0.05, 0.7, 0.1, 1) | |
--tanrei-sys-motion-easing-enter | cubic-bezier(0.2, 0, 0, 1) | |
--tanrei-sys-motion-easing-exit | cubic-bezier(0.3, 0, 1, 1) | |
--tanrei-sys-motion-easing-linear | cubic-bezier(0, 0, 1, 1) | |
--tanrei-sys-motion-easing-spatial | cubic-bezier(0.2, 0, 0, 1) | |
--tanrei-sys-motion-easing-standard | cubic-bezier(0.2, 0, 0, 1) | |
--tanrei-sys-motion-easing-standard-accelerate | cubic-bezier(0.3, 0, 1, 1) | |
--tanrei-sys-motion-easing-standard-decelerate | cubic-bezier(0, 0, 0, 1) | |
--tanrei-sys-motion-easing-state | cubic-bezier(0.2, 0, 0, 1) |
Generated from design/tokens/tanrei.light.tokens.json, tokens/sys/motion.tokens.json
Each token is a custom property in tokens.css. Time your own transitions by the role of what moves, so that they keep pace with the components and follow every layer and dial:
.result-row {
transition: background-color var(--tanrei-sys-motion-role-state-large) var(--tanrei-sys-motion-easing-state);
}- Every surface appears the same way. A menu, a select’s list, a popover, a tooltip, a dialog, a snackbar: each starts from the same opacity, scale, distance and blur (
tanrei.sys.motion.appear.*), and leaves the same way back. In the default system it fades in from a scale of 0.96, grown from where it comes from: the edge that faces its anchor, a modal surface’s centre, the window’s edge for a snackbar. A sheet slides in from its edge whatever the appearance. One choice,sys.behavior.appearance, sets them together (Where a surface appears from). - A motion turned round goes on from where it is. Close a menu halfway through its entrance and it leaves from the value shown, with no jump and no flash of another state.
- A box that changes size moves in its layout. A text field that grows by a line, or an error message that opens below a field, changes its size at every frame, so what stands after it moves with it. Its content stays fixed to its edge, and nothing inside it scrolls on the way.
- A motion starts at its first frame. A surface opened, or a state changed, at the end of a long task — a list that renders many rows as it opens — plays its motion from the first frame drawn after that task, instead of appearing already finished. A motion a component pauses and resumes, such as a marquee text’s pass or a carousel’s autoplay progress, goes on from where it was held.
- The focus ring is never animated. It appears at once, so a keyboard user never waits to see where they are.
- A press is answered by the state layer.
sys.behavior.pressed-feedbackisoverlayin the default system; a system that choosesrippletimes the ripple bytanrei.sys.motion.role.feedback.
A component draws its first frame in the state its attributes and content give it, with no transition into that state. A checkbox written checked, an accordion item written open, or a field that measures itself after its first render is simply there when the page appears. Each of the package’s elements carries data-tanrei-settling from the moment it is connected until two frames after its first render, and nothing inside it starts a transition meanwhile.
An overlay written open in the page’s markup, such as <tanrei-dialog open>, is there in the first frame without its entrance. An overlay opened, or added open, after the page has been painted plays its entrance as usual.
Motion is reduced when either of two settings asks for it:
- The person’s setting, in their operating system or browser:
prefers-reduced-motion: reduce. - Your app’s own setting: the
data-tanrei-motion="reduce"attribute on the root element.
Both have the same effect on every component. Movement, scaling and blur are replaced by a short change of opacity over tanrei.sys.motion.role.reduced (100 ms), and changes of size happen at once. A marquee text stops moving, a loading indicator stops turning and fades its opacity instead, and a skeleton stays still. Show delays are kept, because they measure a wait, not a motion.
If your product has a “reduce motion” setting of its own, set the attribute once on <html>:
<html data-tanrei-motion="reduce">or from script, when the setting changes:
function setReducedMotion(reduce) {
if (reduce) document.documentElement.dataset.tanreiMotion = 'reduce';
else delete document.documentElement.dataset.tanreiMotion;
}The components follow the change at once, with no reload. The attribute can only reduce motion: reduce is its only value, and there is no value that turns motion back on when the person has asked for less (WCAG 2.3.3). It relies on style container queries; a browser without them follows prefers-reduced-motion alone, and the attribute then reduces only the motion that components play from script.
tokens.css gives either setting as one inherited value, --tanrei-motion: reduce. To reduce motion in your own CSS under both settings, write the same rules under the media query and under a style query of that value, as the components do:
@media (prefers-reduced-motion: reduce) {
.promo-banner { animation: none; }
}
@container style(--tanrei-motion: reduce) {
.promo-banner { animation: none; }
}This page describes the web package. The native packages follow the platform’s own setting (accessibilityReduceMotion in SwiftUI, the animator duration scale on Android, MediaQuery.disableAnimations in Flutter, AccessibilityInfo.isReduceMotionEnabled() in React Native). On Flutter an app reduces motion for itself by overriding MediaQuery above its widgets; SwiftUI, Jetpack Compose and React Native do not have an app-wide setting of their own yet.
Every value is listed in the motion token reference.