Motion
The motion rules every component follows, and reduced motion.
Thrum components move like the needle of a well-damped meter: quickly, and without passing the mark. Every duration, easing and spring comes from one file, lib/thrum-motion.ts, which is installed with your first component. You do not configure motion to use a component. This page is for knowing what to expect, and for making your own parts move the same way.
The tokens
These are the real values, read from the file when this page was built.
Durations
| Token | Value | Used for |
|---|---|---|
DUR.fast | 150 ms | Hover, press and focus. Colour and opacity only. |
DUR.base | 200 ms | Chrome leaving. An exit is shorter than an entrance. |
DUR.enter | 250 ms | Chrome entering, and marks that grow from a baseline. |
DUR.morph | 400 ms | A value changes: how long the data spring appears to take. |
DUR.reveal | 700 ms | The first draw of a line or area. |
In code, durations are in seconds, as the motion library expects: DUR.reveal is 0.7.
Easings
| Token | Curve | Used for |
|---|---|---|
EASE.out | cubic-bezier(0.23, 1, 0.32, 1) | Entering: fast at first, then settling. |
EASE.inOut | cubic-bezier(0.77, 0, 0.175, 1) | Not used by a preset yet. |
EASE.standard | cubic-bezier(0.2, 0, 0, 1) | Hover, press and focus. |
Springs
| Token | Settings | Used for |
|---|---|---|
SPRING.control | stiffness 1400, damping 67 | Switches, thumbs, buttons. Under 1% overshoot. |
SPRING.surface | stiffness 700, damping 48 | Cards, panels, popovers. Under 1% overshoot. |
SPRING.data | visualDuration 0.4, bounce 0 | Every data mark: bar height, line shape, meter fill, number roll. No overshoot. |
SPRING.follow | stiffness 3800, damping 123 | Anything that tracks the pointer, such as a chart cursor. |
SPRING.data is set by how long it appears to take, in seconds, with no bounce. The other three are set by stiffness and damping, and are damped hard enough that they do not visibly pass their target.
Ready-made transitions
| Token | Settings | Used for |
|---|---|---|
REVEAL | duration 0.7, ease linear | First draw of a line: constant speed, like a pen on a strip chart. |
ENTER | duration 0.25, ease cubic-bezier(0.23, 1, 0.32, 1) | Enter for chrome and for marks that grow from a baseline. |
FAST | duration 0.15, ease cubic-bezier(0.2, 0, 0, 1) | Hover, press and focus. |
INSTANT | duration 0 | What every transition becomes under reduced motion. |
staggerDelay(index, count) spaces a group of marks 40 ms apart, and closes the gaps in a large group so the last mark never starts more than 300 ms after the first. With 5 marks the last one starts after 160 ms; with 20 it starts after 300 ms.
The rules
- No overshoot on data. A line, bar, arc or number never passes its true value, even for a frame. A chart that bounces shows, for a moment, a value that was never measured. Only chrome may spring.
- Interruptible. A new value that arrives during an animation retargets it from where it is now. Nothing restarts and nothing queues, so a number that changes twice in a second rolls once, to the latest value.
- Reveal follows the reading direction of the mark. A line or area is wiped in from left to right at constant speed, the way a recorder pen draws it. Marks with a baseline, such as bars, grow from that baseline, staggered.
- The entrance plays once. After the first draw, a data change moves the marks from where they are to where they belong. If the number of points changes, the chart switches at once.
- Nothing around it moves. An animating number reserves the width of its final value. A chart's frame has its final size before the data draws.
- Data settles; feedback loops pause when asked. Charts, meters, numbers and controls animate when they appear or when their data changes and then come to rest. Feedback and ambient effect components (spinners, skeletons, text shimmer, marquees and border beams) loop gently while active and stop immediately under reduced motion.
Use the tokens in your own code
To make a part of your own move like the components, take its transition from the same file. useTransition returns the transition you pass, or an instant change when motion is reduced:
"use client";
import { motion } from "motion/react";
import { SPRING, useTransition } from "@/lib/thrum-motion";
/**
* A bar that grows to `level` (0 to 1) like a Thrum data mark:
* no overshoot, and instant under reduced motion.
*/
export function LevelBar({ level }: { level: number }) {
const transition = useTransition(SPRING.data);
return (
<div className="h-2 w-40 rounded-sm bg-muted">
<motion.div
className="h-full origin-left bg-primary"
initial={false}
animate={{ scaleX: level }}
transition={transition}
/>
</div>
);
}Reduced motion
Every component reads the visitor's system setting (prefers-reduced-motion). When it asks for less motion, components show their final state in the first frame: no wipe, no stagger, no rolling digits. Data still updates; it steps to the new state. There is nothing to set up.
You should see
Turn on “reduce motion” in your operating system's accessibility settings, or emulate it in your browser's developer tools, and reload. Charts appear complete. A changed value shows at once, with no movement. The cursor of a chart still follows the pointer, without easing.
Force reduced motion from your app
If your app has its own motion setting, wrap any part of the tree in MotionConfig from motion/react. Thrum components inside it reduce their motion whatever the system says:
import { MotionConfig } from "motion/react";
export function Dashboard({ calm }: { calm: boolean }) {
return (
<MotionConfig reducedMotion={calm ? "always" : "user"}>
<AreaChart data={data} label="Revenue" />
</MotionConfig>
);
}"always"reduces motion for everything inside."user"follows the system setting. This is also what happens with noMotionConfigat all."never"does not override the visitor. If the system asks for reduced motion, Thrum components still reduce it.
The Motion switch in this site’s Appearance studio and status bar combines both layers: it sets data-motion="reduced" on <html> (which zeroes CSS transitions and keyframe animations) and passesreducedMotion="always" through MotionConfig. In your own components, useReducedMotion() from lib/thrum-motion.ts reads both MotionConfig and the systemprefers-reduced-motion setting and returns a boolean.