Opacity of Visual Stimuli not updating, but exiting full-screen updates them

URL of experiment:


Description of the problem:

I am running into a strange quirk. In my experiment, I have an array of circles that have their opacity changed based on the value of a variable that is updated using code. When I run the experiment, the circle that is filled in does not update accordingly. However, if I press F11 and either exit or enter full screen, that change in opacity that SHOULD occur is reflected, but when the opacity goes to update again, no change occurs. Again, either exiting or entering full-screen will produce the change.

Here is an image to show when certain code is executed. Again, it is not the code that is the issue, the experiment works as intended, it is just creating a problem where things are not updating unless the screen is changed.


There is a circular array of ten circles. In Spatial_Fixation routine, a value is selected. In Spatial_Blank routine, opacity of a circle is changed based on the value from previous routine. In Spatial_Target routine, the array of circles is displayed, with one circle being filled in based on the value selected in Spatial_Fixation routine. The loop then repeats and generates a new value.

Again, this is not an issue with the way the values are updating, or how the opacities are updated based on the value. If I press F11 on every “Spatial_Target” screen, then the experiment operates as intended, but continuously switching between full-screen and not full-screen is obviously problematic. Can anyone think of what is occurring when the experiment transitions between screen formats that would cause a change to be reflected after switching screen types, but remaining static if staying on a single screen output type (e.g., full screen)?

Does anyone have any insight on this or have run into similar issues?

Here is a link to the code for the experiment if anyone is able to discern why the visual stimuli is not updating across trials unless I shift between full screen and non-full screen each trial:

Hi @DCzarnowski,

Sorry for the trouble! We replicated your bug and we’ve got a hunch about what the problem is. If you don’t hear back from us within a week or two, please give a shout.

Best, Thomas

Hi Thomas,

Thank you very much! I was beside myself trying to figure out what was causing the problem, so it’s refreshing to know I didn’t miss something staring me right in the face!


Dear @DCzarnowski, many thanks for flagging, apologies for the late response.

As it happens opacity is off the list of attributes queued up for dynamic updates in PsychoJS at the moment, but you’ll be pleased to know a patch is on the way.

For your convenience, I have prepared a fork that includes a local PsychoJS lib folder containing the fix, if you are happy copying those files over to your project.

The only thing is, when you export HTML again as you further develop your experiment, you will then have to each time manually edit line #9 to import from ./lib/visual-2020.2-patch.js.

That is no doubt annoying, which is why I will for sure be following up here in the coming days to let you know that a permanent fix has been made available on Pavlovia.

Please let me know if you need more support, here to help, s.

1 Like

Thanks so much! Works like a charm.

Hi @DCzarnowski, OK the newly released PsychoPy 2021.1.4 now includes a permanent fix for dynamically adjusting opacity in JS so you should no longer have to rely on any custom patches for that, x