| 12345678910111213141516 |
- import { frame, cancelFrame, frameData, time } from 'motion-dom';
- const frameloopDriver = (update) => {
- const passTimestamp = ({ timestamp }) => update(timestamp);
- return {
- start: () => frame.update(passTimestamp, true),
- stop: () => cancelFrame(passTimestamp),
- /**
- * If we're processing this frame we can use the
- * framelocked timestamp to keep things in sync.
- */
- now: () => (frameData.isProcessing ? frameData.timestamp : time.now()),
- };
- };
- export { frameloopDriver };
|