useMotionTokens
Transition settings for motion-v, read from the duration tokens each call, so a preset switch and prefers-reduced-motion (which shortens every duration to 80 / 100 / 70ms) reach JS-driven animation the same way they reach CSS transitions.
Install: pnpm add-composable useMotionTokens
With motion-v
Call enter() and exit() when the animation starts, not once at setup, so a preset switched mid-session is picked up.
API
state(() => { duration: number; ease: [number, number, number, number] }): Something moving between two states, such as a pill sliding. Read from --vt-duration.enter(() => { duration: number; ease: [number, number, number, number] }): Something appearing. Read from --vt-duration-enter.exit(() => { duration: number; ease: [number, number, number, number] }): Something leaving, shorter than its entrance. Read from --vt-duration-exit.parseCssTime((raw: string, fallbackMs: number) => number): Parses a CSS time ("200ms", ".2s", or a bare number of ms) into seconds. Falls back when the value does not parse.