| Reference | Downloads | Github

Command line with "set" vs. without

This is a very general question on whether there is any difference between using the version of a function with “set” vs. without in a code component. E.g., does it matter whether to use stimulus.fillColor() vs. stimulus.setFillColor() to change the color of a stimulus? I have tried both, and both change the color as expected. However, I have the impression that stimulus.fillColor() is slower than its alternative, i.e., that it requires more resources esp. when running the experiment online on pavlovia.

Do you mean stimulus.fillColor = red vs stimulus.setFillColor(red) ?

(where red has been previously defined as [1,-1,-1] in Python and new util.Color([1,-1,-1); in JS as per my crib sheet)

My experience is the setFillColour works better for shapes but stimulus.color=red works better for text.

1 Like

Yes, I meant

stimulus.fillColor = red vs stimulus.setFillColor(red)

As far as I understand from your answer, there is no crucial difference or reason why to prefer one over the other. Thanks for your help.

I don’t have underlying knowledge of the difference but my impression is that the version with set to works better online, except for text.color.

1 Like