createAnimationFrame
Runs a function on motion-solidjs's shared frame loop. Use it instead of a local
requestAnimationFrame when the callback reads or writes values that motion also manages.
import { createAnimationFrame, createMotionValue } from 'motion-solidjs'
function Ticker() {
const t = createMotionValue(0)
createAnimationFrame((timestamp, delta) => {
t.set(t.get() + delta)
})
return <span>{t.get().toFixed(0)}</span>
}
✦
elapsed: 0.00sThe callback receives (timestamp, delta). Return early when you want to skip a frame.