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:
parent
cf0f2191f1
commit
523dc2d006
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user