psychopy.org | Reference | Downloads | Github

Moving cursor stimuli


#1

Can anyone tell how can I create a moving cursor as stimuli in Psychopy Builder?


#2

You simply put variables in the stimulus’ position field that change with time. You need to detail exactly what you mean by “moving” for anyone to give more specific suggestions.


#3

Michael,

I am quite new with PsychoPy and I am not fully familiar with all of its capabilities.

Regarding the stimuli, I want to have a circle-like cursor moving horizontally in some trials and moving vertically in some other trials with constant velocity. I am not sure how can I proceed with PsychoPy to design such a thing.


#4

Builder maintains a variable called t that represents the time elapsed in seconds since the start of the trial. So if you put an expression like:

(t, 0)

in the position field of stimulus, and set that field to update on every screen refresh, and set the units of the stimulus to be, say, cm, then the stimulus would move rightwards at a constant velocity of 1 cm per second while staying fixed vertically.

To make it go faster or slower (or to scale for using other units, like pixels or normalised units), multiply t by some factor:

(3 * t, 0)

To make it start from 10 units to the left of centre:

(-10 + t, 0)

etc.

If you want to mix horizontal and vertical movement from trial to trial, then you should have a pair of variables in your conditions file called, say horizontal and vertical, with values of 0 (don’t move in this direction) or 1 (do move in this direction), then put those variables in your formula so that either the horizontal or vertical component gets set to 0 on each trial:

(t * horizontal, t * vertical)

#5

Thanks Michael!

That was very helpful.