I want to draw as part of an experiment a transparent rectangle as a stimuli on the screen. When I run the experiment offline, everything works. But online the following error occurs: “ ReferenceError: None is not defined ”
I think the problem is the “None” in this part of my code:
Hi,
I just used the Builder and didnt add any code! For making the rectangle transparent, I defined the colour of the rectangle in the Builder View as “$None“.
Regards
I’m a bit confused. I think you don’t need to set a variable. Instead you can just set the “opactity” (in the “Basic” tag) to in the range from 0 to 0.5 to make a triangle transparent.
Thank you very much, but I think I should describe my experiment in more detail: I try to develop an adapted version of the stroop task. I already set the opacity of the rectangles, because in some trials they should appear and sometimes not. But now I want to make the filling colour transparent and this does not work in the online version (offline it works pretty well!).
I am sorry for the confusion!
seems like some others also encountered similar issues. this is due to Python>JS translation and the solution is to replace “none” with “null” in your JS file.
btw it seems that later version has already fixed this issue
You could always set the fill color to the background color to appear transparent, and that way this color can be stated in the conditions file. Then, its just a question of changing the shape color on each trial.
Interesting though, that when you set the fill color to None the default is not the same as the background color, but displays a black fill. I think this needs posting on GitHub as an issue, so that the JavaScript behaviour matches the Python behaviour.
If you use “None” as your color (not ‘$None’), then PsychoPy will convert it to undefined for you, and you will no longer have your error. Adding the extra dollar sign interferes with the conversion process, so needs to be fixed.
You should really just try setting the fill color the same as the background. You will keep your outline, but the shape will look unfilled because the color is the same as the background. Try adding $[0,0,0] in place of None.
I could not set the fill color the same as the background, because the rectangles should be drawn around some words of the stroop task (to mark task switching). Anyway, I found a solution for my problem: I used a transparent image of an rectangle and now my experiment works.
I encountered the same problem, when i want to draw a transparent rectangle using Polygon by setting the fill color as None. The experiment offline, everything works. But online the following error occurs: “ ReferenceError: None is not defined ”. Is it possible to fix the problem except using a transparent image of a rectangle. How to set the fill color as None in Javascript of online experiment.
Hi everyone, for people wanting to create transparent shapes for use on Pavlovia that have a non-transparent outline, I’ve found it’s really easy to do by creating a transparent shape in Powerpoint.
Draw your shape in Powerpoint with the border color/weight that you’d like. Then, right click the shape >> ‘Format shape’ >> ‘Fill’ to ‘Solid fill’ and slide the Transparency slider to 100%.
Then, right click the background >> ‘Format Background’ >> ‘Fill’ to ‘Solid fill’ and slide the Transparency slider to 100%.
Then save & right click your shape, and click ‘Save as Picture’, and make sure to save it as a .png file type. This will save the transparency aspect that will be treated as transparent in both psychopy and psycojs.
Hi everyone, I am having the same problem! I am unable to set the colour to “None” or “undefined” or “null”. Could someone please update me on whether this is fixed and if not, whether anyone has found a solution? I am using PsychoPy v2023.2.1 and works great offline but is a nightmare to fix online