Polygon size flashes before displaying the correct size

PsychoPy version: 2022 1.2
Description of the problem:
The polygon size (rmsSize,rmsSize) is supposed to start with rmsSize = 0.05 and change according to the slider position.
It does, but not before it flashes.
My code at the moment:
Begin experiment:

rmsRating = 0;
rmsSize = 0.05 + (0.002 * rmsRating);

Each frame:

if (typeof slider_rms._markerPos !== 'undefined') {
    rmsRating = slider_rms._markerPos;
rmsSize = 0.05 + (0.002 * rmsRating);

What did you try to make it work?:
I do not know why it flashes… therefore I don’t know what to fix…
I have tried to set polygon size in builder to $(0.05 + (0.002 * rmsRating),0.05 + (0.002 * rmsRating)), but it still flashes.
I’m not sure where to go next.

Thanks in advance for any help.

Hi @Lan, I can’t tell you why, but apparently setting the polygon size to be updated “every frame” causes this glitch. You can circumvent it by setting it to “set every repeat” and then adjusting the size with the following line of code in your “each frame” tab:

polygon_rms.size = rmsSize

1 Like

My feeling is that when you have something set to “Every Frame” then it updates for the first time at the end of the first frame, so one frame uses the default values. It might work to use polygon_rms.size = rmsSize in Begin Routine and still use Each Frame, though I personally do tend to avoid using code in an Each Frame tab instead of using Each Frame in a component.

1 Like