createMotionValueEvent
Subscribes to one of a MotionValue's event types and disposes the subscription with the component.
import { createMotionValueEvent, createScroll } from 'motion-solidjs'
function ProgressLogger() {
const { scrollYProgress } = createScroll()
createMotionValueEvent(scrollYProgress, 'change', (latest) => {
console.log('scroll', latest)
})
return null
}
x = 0.0
Event types
'change'- value changed'animationStart'/'animationComplete'/'animationCancel'- animation lifecycle'renderRequest'- a frame was requested