@liquidify/motion
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:
stepSpringandisSettledfor pure damped-spring calculations;createSchedulerfor an injectable request-animation-frame scheduler;getSharedSchedulerfor the process-wide lazy scheduler used by the glass engine;- the related state, parameter, callback, and scheduler types.
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.