For a mouse-tracking experiment to be run online I need to create clickable transparent polygons on top of my two text stimuli. I’d like the parameters of the polygon to dynamically adapt to those of the texts.
Position of text is defined by the following code:
#Begin experiment target_positions = [0.4, -0.4] * 5 shuffle(target_positions) #Begin routine target_x = target_positions.pop() competitor_x = target_x * -1 thisExp.addData('target_x', target_x) thisExp.addData('competitor_x', competitor_x)
Size of text is defined automatically through number of characters I guess.
There’s a target_text component with position:
[target_x, 0] and a compet_text component with position:
So far I’ve tried setting the size of the position of the polygons (polygon_target and polygon_compet) like this:
[target_x[trials.thisN], 0] but I don’t really know what I’m doing and so it doesn’t work.
For now I’ve only set constant sizes like (0.5, 0.1) because I’ve tried a few different things like
(target_text$width, target_text$height) but that doesn’t work either - again, I don’t know how to code.
Finally, this will all need to be transferred to Pavlovia. I’ve tried unsuccessfully to convert the randomization to JS but that’s in another one of my posts Randomization not working online (problem with "map"?)). It would just be perfect if any solution for the polygons would come with its JS translation.
Your help is much appreciated, as always. Thank you!