We’re working on bringing PsychoJS more in line with PsychoPy in general, and colours are an area we’re particularly focused on. RGBA works in python so hopefully soon we’ll be able to match that in JS
Until then, the solution Becca proposes should work just the same.
Thank you both for the really quick replies, I really appreciate it!
Unfortunately, it’s not working on my end. I am getting this error:
TypeError: Cannot set property ‘alpha’ of undefined.
The console identifies this code as the issue:
flash._pixi.alpha = FlashLum;
Without any changes in outcome, I have tried this line of code in the begin routine and each frame sections of a code component. I have also tried running it as: flash.pixi.alpha = FlashLum
I am a bit confused about why it thinks the polygon component is undefined when Becca’s line of code is inserted, as that code belongs to this block of code, which executes successfully in its absence:
if you comment out line 15 and use window.flash = flash then open the console whilst running your task in browser can you inspect if flash has the attribute ._pixi?
alternatively is the code component rendered before or after your polygon in the routine?
When I type in flash into the console, ._pixi becomes a suggested fill-in option.
However, when I enter flash._pixi into the console, it comes up undefined. I have attached a screenshot below.
I believe the code component is rendered before the polygon, as I am trying to change/set the alpha before the first frame is drawn. However, in the screenshot above, the error caused by flash._pixi.alpha is in the each flash tab, and should only be altering the alpha of an already rendered flash.