| Reference | Downloads | Github

Animating a figure

I am new to psychopy and was wondering if anyone can give me some guidance.
The task I am trying to build is as follows:

  1. the user is presented with 10 human figures and needs to select a figure that most resembles herself, one that resembles a friend and one that does not look familiar.
  2. the user then sees a screen with a large circle on it, where the figure that most resembles herself is in the middle, and either the “friend” or the “stranger” is approaching. the user presses a key to stop the approaching figure. this is repeated several times for each figure, from different directions.

The issue I am having is with the animation of the figure.
I know I can use short movies but I am trying to refrain from that since that would mean I would need to manually record 10 (options for figure in the middle) *9 (options for figure approaching)*4 (directions) *2 (genders: male/female) = 720 movie clips.

I am looking for a more efficient way to handle this.

Any tips?
I searched through the demos and could not find one that helped me.


You could easily move the figure using the pos attribute in the image component - but this wouldn’t create a walk cycle - the image would just move from one side of the screen to the other - for that you’d need to use Flash or some sort of animation package.

For some reason when I try to use the pos attribute the image just flashes quickly and then disappears. I must be doing something wrong

here is what I did:

  1. I inserted the image to the trial
  2. in the image settings:
  • I left the start time at 0
  • changed the stop to duration 4 seconds
  • inserted the image path
  • on the pos attribute I typed [frameN,0] and changed the drop down menu to “set every frame”
  • left the rest with default values

What am I missing?

If you are using norm units, the object will probably be moved out of the visible screen area by frame 2 :slight_smile: You will want pix units instead in this case.


You are right! Thank you, this helped.
Now - is there any way for me to control the movement? I have an image that I need to move from point X to point Y within 3 seconds. Is there a way to control that?

You need to work out the rate of movement that would be needed to cross that gap and use that as your multiplier for t (or frameN). In 3 secs you’ve got 180 frames. f you want to move 100 pixels then you need to move 100/180 pixels on each frame so use [frameN*100/180, 0]

All this is the sort of thing we’ll cover in depth at the workshop :wink:

Thank you so much!
(And while I have the chance - thank you also for creating this awesome tool :slight_smile: )
I would absolutely love to attend a workshop, however I live in Israel and the commute might be expensive. I also need to complete the building of the experiment a lot earlier in order to meet the timelines of my program.
Have you considered creating a (paid) online course?