createMotionValue
A MotionValue is a reactive value that motion-solidjs can update without rerunning Solid
components. Read it with .get(), write it with .set(), and subscribe with .on('change', cb).
When passed to a motion.* style prop, the engine writes each frame straight to the DOM.
import { createMotionValue, motion } from 'motion-solidjs'
function Demo() {
const x = createMotionValue(0)
return <motion.div style={{ x }} drag="x" />
}
drag me
API
createMotionValue(initial)- create a value.get()- read the current value.set(v)- update the value and notify subscribers.on('change' | 'animationStart' | 'animationComplete' | 'animationCancel', cb)- subscribe.destroy()- clean up subscriptions