URL of experiment: https://pavlovia.org/FRR/rsa_study_v01

Description of the problem:

This is my first psychopy/JS experiment - I hope I provide all the necessary info. Thanks for any input!

I want participants to move a disk on the screen. They have 5 seconds and should be able to move the stimulus at least once around a circle. Currently, I each time they press a key the angle changes by 2. With a refresh rate of 60Hz, in theory that means I should make it around the circle in 3 seconds (60*2 steps = 120/sec). But it seems that a response is not recorded with every flip. I am only making it around 1/4 or 1/3 of the circle in 5 seconds. Since I do not want to loose precision, I don’t want to increase the increments in which the circle moves around (angle + x below).

I have read here: Adjust bar orientation through keyboard the suggestion to add an “event listerner” and check for “keydown” to make sure that no reponses are missed, but I am not quite sure how to implement this, and if this is a good approach.

This is my JS code - it works but seems to ‘miss’ responses/not update often enough if key is held down:

BEGIN ROUTINE:

angle = featVal;

myx = xcoord;

myy = ycoord;

EACH FRAME

var thisResp = psychoJS.eventManager.getKeys();

if (“left” == thisResp[0]) {

angle = (angle - 5);

myx = (0.25 * Math.sin((((Math.PI * 2) * angle) / 360)));

myy = (0.25 * Math.cos((((Math.PI * 2) * angle) / 360)));

smallcircle2.setPos([myx, myy]);

}

if (“right” == thisResp[0]) {

angle = (angle + 5);

myx = (0.25 * Math.sin((((Math.PI * 2) * angle) / 360)));

myy = (0.25 * Math.cos((((Math.PI * 2) * angle) / 360)));

smallcircle2.setPos([myx, myy]);

}

psychoJS.eventManager.clearEvents({eventType:‘keyboard’});