psychopy.org | Reference | Downloads | Github

Libet Clock in Builder to use it on Pavlovia

Hi everyone,
I am trying to create an experiment in which I will use the Libet Clock. For those who do not know what it is, it is basically a rotating clock with min. marked on it. I will be asking the participants to judge the time they made a key press. Yet, they will be doing the judgment by marking the point of the action on the clock with the clock hand. (I thought just writing the minute they made the action would be imprecise, if there is a better/easier suggestion just feel free to tell it please.) Yet I have no idea how I can implement this marking process.

More specifically, how can participants control the line to mark the time on the clock? And how can I understand the answer of the participants?

I saw there are codes of this task in the python language. Yet, I will be doing the experiment online and I have a very limited knowledge about how to translate python code to JS. So, I am trying to create the task on the builder so that I can use it on Pavlovia thanks to automatic translation feature of the Psychopy into JS.

PS: it is probably very easy but I failed to draw a clock either. I found a code here for a rotating line like a clock hand. It is very useful. Yet, I need to draw a circle around it and write numbers referring to minutes so that it looks like a clock which I failed to do.

If there is anyone who can give me some tips about any of the issues I would be grateful. Thank you all in advance.

I can’t remember the formula off the top of my head but it would be fairly easy to have a polygon with one variable defining it (the angle) that rotates about the centre of the screen instead of the centre of the polygon. This angle / 6 would be the saved value.

One way to have an intuitive way of moving the hand would be to have two additional invisible polygons…one slightly ahead and one slightly behind. You could then use the .contains method to see if the mouse is in one of the two invisible polygons and adjust the angle accordingly.

Alternatively, just get the location of mouse clicks, calculate the angle and move the hand accordingly

1 Like

Hi, thank you a lot for the reply. I am trying your suggestion which is to get the position of the mouse click and draw the clock hand accordingly. Yet, I am not sure how to calculate the angle from the mouse position (x,y) since I guess there is no function for tan-1 calculation. I am sorry if it is a trivial question.

A quick Google suggests that you want Math.atan