Framework-neutral spring integration and shared frame scheduling.
Experimental: this low-level package is intended for deliberate engine and custom-motion work.
pnpm add @liquidify/motionThe package has no React dependency. Its public API includes:
stepSpring and isSettled for pure damped-spring calculations;createScheduler for an injectable request-animation-frame scheduler;getSharedScheduler for the process-wide lazy scheduler used by the glass engine;import { isSettled, stepSpring, type SpringState } from "@liquidify/motion"
let state: SpringState = { value: 0, velocity: 0 }
state = stepSpring(state, 1, 1 / 60, {
stiffness: 240,
damping: 28,
})
if (isSettled(state, 1)) {
state = { value: 1, velocity: 0 }
}stepSpring accepts delta time in seconds and clamps long frame gaps internally. Prefer the shared scheduler when multiple surfaces animate in one document; use createScheduler when an isolated or test-injected clock is part of your architecture.