psychopy.org | Reference | Downloads | Github

Changing image colour online


#1

Hi all,

I’m having trouble conditionally changing the colour of Image stim when running demos on Pavlovia.

Offline, I can do this easily using something like:
if …(button is clicked)
…stimName.color = ‘red’

However, when manually converting this code into JS, I’ve only managed to get this to work online when Polygon stim are used (Image stim simple won’t change colour):
stimName.fillColor = new util.Color(‘red’);

I have zero experience with Javascript (and little with Python, as I mostly use the Builder view), so I’m probably missing something very simple in my JS coding… But if anyone is able to help me out here, that should be enough to get my experiment going online!

Many thanks :slight_smile:


#2

Thanks for the post Jamie, indeed, even if you set the color to change for you image in Builder, the image color does not change online (but does locally on your desktop). WIll flag this as a bug on GitHu - see https://github.com/psychopy/psychojs/issues/29