mirror of
https://github.com/nvms/prsm.git
synced 2025-12-16 08:00:53 +00:00
adjust fps calc
This commit is contained in:
parent
a05a3810a2
commit
74bc7163a2
@ -147,7 +147,13 @@ export const createWorld = () => {
|
|||||||
* so that we can run tests for this in node.
|
* so that we can run tests for this in node.
|
||||||
*/
|
*/
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
raf = requestAnimationFrame;
|
let now = performance.now();
|
||||||
|
raf = (cb: FrameRequestCallback): number => {
|
||||||
|
return requestAnimationFrame((timestamp) => {
|
||||||
|
now = timestamp;
|
||||||
|
cb(now);
|
||||||
|
});
|
||||||
|
};
|
||||||
craf = cancelAnimationFrame;
|
craf = cancelAnimationFrame;
|
||||||
} else {
|
} else {
|
||||||
let now = 0;
|
let now = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user