adjust fps calc

This commit is contained in:
nvms 2024-09-09 09:39:57 -04:00
parent a05a3810a2
commit 74bc7163a2

View File

@ -147,7 +147,13 @@ export const createWorld = () => {
* so that we can run tests for this in node.
*/
if (typeof window !== "undefined") {
raf = requestAnimationFrame;
let now = performance.now();
raf = (cb: FrameRequestCallback): number => {
return requestAnimationFrame((timestamp) => {
now = timestamp;
cb(now);
});
};
craf = cancelAnimationFrame;
} else {
let now = 0;