Inconsistent delta when using requestAnimationFrame and Date.now()

I have a simple snippet: let startTime = -1 let lastNow = -1 let lastTS = -1 const animate = (timeStamp)=>{ requestAnimationFrame(animate) const now = Date.now() if(lastTS===-1){ lastTS = timeStamp lastDate = now } const deltaTS = timeStamp – lastTS lastTS = timeStamp const deltaNow = now – lastNow lastNow = now console.log(deltaTS,deltaNow) } animate(-1)… Read More Inconsistent delta when using requestAnimationFrame and Date.now()

requestAnimationFrame is not defined in web-worker in Firefox?

I can’t find any information why Firefox v91.10.0esr on Windows 10 complains that requestAnimationFrame is not defined: const worker = new Worker( URL.createObjectURL( new Blob( [“requestAnimationFrame(() => this.postMessage(‘requestAnimationFrame in web-worker process’))”] , { type: “text/javascript” }))); worker.addEventListener(“message”, e => { console.log(e.data); }); requestAnimationFrame(() => console.log(“requestAnimationFrame in main process”)); 19:09:53.100 ReferenceError: requestAnimationFrame is not defined 569ddce0-b6c3-47c9-88b4-89d59445b335:1:1… Read More requestAnimationFrame is not defined in web-worker in Firefox?