From 39fce46e90bf87345d967144b9e2df20e2925d37 Mon Sep 17 00:00:00 2001 From: lgtst Date: Wed, 25 May 2022 21:27:53 +0300 Subject: [PATCH] updating stims before rendering them and rendering before running tasks; --- src/core/Window.js | 5 ++--- src/util/Scheduler.js | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/Window.js b/src/core/Window.js index 48941bb9..0fc4a594 100644 --- a/src/core/Window.js +++ b/src/core/Window.js @@ -342,6 +342,8 @@ export class Window extends PsychObject } this._frameCount++; + // update the stimuli (including pixi stuff) before rendering + this._refresh(); // render the PIXI container: this._renderer.render(this._rootContainer); @@ -368,9 +370,6 @@ export class Window extends PsychObject // log: this._writeLogOnFlip(); - - // prepare the scene for the next animation frame: - this._refresh(); } /** diff --git a/src/util/Scheduler.js b/src/util/Scheduler.js index 15219704..f4782e4d 100644 --- a/src/util/Scheduler.js +++ b/src/util/Scheduler.js @@ -143,6 +143,9 @@ export class Scheduler // self._psychoJS.window._writeLogOnFlip(); + // update stimuli and render the scene in the window: + self._psychoJS.window.render(); + // run the next scheduled tasks until a scene render is requested: const state = await self._runNextTasks(); if (state === Scheduler.Event.QUIT) @@ -157,9 +160,6 @@ export class Scheduler self._lastDelta = timestamp - lastTimestamp; self._lastTimestamp = timestamp; - // render the scene in the window: - self._psychoJS.window.render(); - // request a new frame: requestAnimationFrame(update); };