psychopy.org | Reference | Downloads | Github

Change speed of moving stimuli

What are you trying to achieve?:
Participants will be presented with an object that moves at different speeds from left to right, and then the object is hidden behind an occluder. I need to change the speed at which the object moves while it is still visible.

What did you try to make it work?:
I found a convoluted solution, which I am not sure is the right one:

  • To animate the object, I created an excel file with a column px containing a list of values. The location of the object is updated on every frame with each value of px

  • Since I’m updating the location of the object on every frame, I calculated by hand how many data frames would be needed for the object to remain visible for 1 sec. Basically, since the refresh rate on my display is 60Hz, it will (I suppose) update the location of the object every 16.7 ms (aprox).

  • To set the speed of the object to 1 sec, I calculated how many 16.7 ms-long data points would be needed to reach 1000 ms (= 1 sec):
    1000/16.7 = 60.
    In the Excel file I created 60 cells, each with a different value for the location of the object.

What specifically went wrong when you tried that?:
It works well (the object moves), but I would like to check whether this solution is the right one, i.e. whether indeed the object takes 1 sec to move when I use 60 different values in my Excel file.

Thanks!
M

If I recall, you are re-playing actual recorded trajectories right? If so, then this sort of approach is the way to go.

If you just want to control the speed of the stimulus moving as some sort of function, then you could just insert calculated values based upon t, the current time in the trial.

To know more about the timing, we’d need to see some screenshots of your flow panel and the settings you are suing in your stimulus component. Hopefully you could check the timing performance by consulting the log files.