How to set polygon colorspace (rgb and hsv) online

URL of experiment: xiaotong yin / slider_online_test · GitLab

Description of the problem: Using a slider to change the color of polygons/images works fine offline, but when I tried to run it online, the slider couldn’t change the color anymore. I had a look at the python code and the Javascript and found that the colorspace setting of the polygon was lost in javascript (though not sure whether or not this is the key reason). Does anyone know how to set polygon colorspace online? Thank you very much!
This is my setting in builder:
builder

Add this code at the begin routine tab to see if it works:

polygonColor = new util.Color([1, 0, 1], util.Color.COLOR_SPACE.HSV);
myPolygon.color = polygonColor;

Change variable names according to your experiment.

1 Like

Hello @Omidrezaa, thank you very much for your reply! I tried the code you suggested but the color of the polygon is pink which is supposed to be white. Then I tried [180, 1, 1] and got this error:

the color components should all belong to [-1, 1]

Then I tried to change hsv values (hue or saturation or value, one at a time, all within [-1, 1]), but the color is always pink. Do you have any thoughts on this?

I’m sorry I have an additional question: is it possible to change the color of an image in each frame online at the present? Many thanks!