useAnimationFrame
An animation loop that outputs the latest frame time to the provided callback.
Runs a callback once every animation frame. The callback is provided a timestamp, in milliseconds, that is the duration of time since the callback was first called.
import { useAnimationFrame } from "framer-motion"
function Component() { const ref = useRef(null) useAnimationFrame(t => { ref.current.style.transform = `rotateY(${t}deg)` })
return <div ref={ref} />}