requestAnimationFrame [now] vs performance.now() time discrepancy

后端 未结 2 1828
面向向阳花
面向向阳花 2021-01-02 05:57

Assumptions: rAF now time is calculated at the time the set of callbacks are all triggered. Therefore any blocking that happens before the first callback of th

2条回答
  •  醉酒成梦
    2021-01-02 06:13

    I encountered the same issue on chrome, where calls to performance.now () would return a higher value than the now value passed into subsequent callbacks made by window.requestAnimationFrame ()

    My workaround was to set the before using the now passed to the callback in the first window.requestAnimationFrame () rather than performance.now (). It seems that using only one of the two functions to measure time guarantees progressing values.

    I hope this helps anyone else suffering through this bug.

提交回复
热议问题