diff --git a/dev/optimized-appear/resync-delay.html b/dev/optimized-appear/resync-delay.html index c13f3cef37..30fe937b88 100644 --- a/dev/optimized-appear/resync-delay.html +++ b/dev/optimized-appear/resync-delay.html @@ -41,11 +41,11 @@ const duration = 0.5 const x = motionValue(0) - x.onChange((latest) => { - if (latest < 50) { + x.on("change", (latest) => { + if (latest < 100) { showError( document.getElementById("box"), - `x transform should never be less than 50` + `x transform should never be less than 100` ) } }) diff --git a/packages/framer-motion/src/frameloop/batcher.ts b/packages/framer-motion/src/frameloop/batcher.ts index d46941ed69..e451e47542 100644 --- a/packages/framer-motion/src/frameloop/batcher.ts +++ b/packages/framer-motion/src/frameloop/batcher.ts @@ -32,7 +32,9 @@ export function createRenderBatcher( const processStep = (stepId: StepId) => steps[stepId].process(state) - const processBatch = (timestamp: number) => { + const processBatch = () => { + const timestamp = performance.now() + runNextFrame = false state.delta = useDefaultElapsed @@ -54,7 +56,9 @@ export function createRenderBatcher( runNextFrame = true useDefaultElapsed = true - if (!state.isProcessing) scheduleNextBatch(processBatch) + if (!state.isProcessing) { + scheduleNextBatch(processBatch) + } } const schedule = stepsOrder.reduce((acc, key) => {