Image position online not updating from last loop

In my experiment I have an image presented in a position initially set by a variable in the Excel conditions file. Each frame, if the participant clicks the mouse then the position of the image will update and when the space bar is pressed the routine ends and a different image will be presented in a different starting position.

This works fine offline on Psychopy but when I go through the experiment in Pavlovia before going to its set starting position each image will flicker in the last position of the image in the previous loop.

The code for each frame is included below:


if mouse.isPressedIn(Cshape) and mouse.getPressed()[0] == 1:
    deg = (deg + 2)
    posX = Eccentricityobj * cos((pi/180) *(deg))
    posY = Eccentricityobj * sin((pi/180) *(deg))
    first_obj_1.setPos([posX,posY])

if mouse.isPressedIn(Cshape) and mouse.getPressed()[2] == 1:
    deg = (deg - 2)
    posX = Eccentricityobj * cos((pi/180) *(deg))
    posY = Eccentricityobj * sin((pi/180) *(deg))
    first_obj_1.setPos([posX,posY])

The starting position in builder is set to update every repeat and is ([obj1posx,obj1posy]) which links to the conditions file.

Hi There,

Your python code looks alright to me, but we would need the JS code to checkout why it is not implementing as you expect online.

However, this does remind me of a VERY similar thing I made that could help https://gitlab.pavlovia.org/lpxrh6/mouse_press_demo (here participants press and hold the mouse in a shape and a polygon moves across the screen).

Hopefully this might help pin point the issue,
Becca

1 Like

oops I see that you posted the original topic that inspired the demo!! are you able to share your project link there?

Also have you maybe tried setting the image to the original position in the ‘end of the routine’ tab?

1 Like

I’ve set the image position at the end of the routine and that seems to work - thanks!