1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-11 16:18:10 +00:00

util/Scheduler: store time delta for each rAF call

This commit is contained in:
Sotiri Bakagiannis 2021-01-29 12:05:56 +00:00
parent cf0f2191f1
commit 523dc2d006

View File

@ -137,7 +137,7 @@ export class Scheduler
start()
{
const self = this;
let update = () =>
let update = (timestamp) =>
{
// stop the animation if need be:
if (self._stopAtNextUpdate)
@ -156,6 +156,12 @@ export class Scheduler
return;
}
// store frame delta for `Window.getActualFrameRate()`
const lastTimestamp = self._lastTimestamp || timestamp;
self._lastDelta = timestamp - lastTimestamp;
self._lastTimestamp = timestamp;
// render the scene in the window:
self._psychoJS.window.render();