# Animating a figure

**URL:** https://discourse.psychopy.org/t/animating-a-figure/1515
**Category:** Builder
**Created:** [November 23, 2016, 9:23am UTC](https://discourse.psychopy.org/t/animating-a-figure/1515 "2016-11-23T09:23:49Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![niras](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@niras](https://discourse.psychopy.org/u/niras)
#### Post date: [November 23, 2016, 9:23am UTC](https://discourse.psychopy.org/t/animating-a-figure/1515/1 "2016-11-23T09:23:49Z")

</div>

Hello,  
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.

Thanks,  
Nira

---

<div class="post-metadata">

### Author: ![Oli](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/oli/32/520_2.png) [@Oli](https://discourse.psychopy.org/u/Oli)
#### Post date: [November 23, 2016, 4:44pm UTC](https://discourse.psychopy.org/t/animating-a-figure/1515/2 "2016-11-23T16:44:37Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![niras](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@niras](https://discourse.psychopy.org/u/niras)
#### Post date: [November 28, 2016, 7:07am UTC](https://discourse.psychopy.org/t/animating-a-figure/1515/3 "2016-11-28T07:07:13Z")

</div>

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?  
Nira

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/richard/32/6389_2.png) [@richard](https://discourse.psychopy.org/u/richard)
#### Post date: [November 28, 2016, 8:17am UTC](https://discourse.psychopy.org/t/animating-a-figure/1515/4 "2016-11-28T08:17:55Z")

</div>

> [@niras](#):
>
> - on the pos attribute I typed [frameN,0] and changed the drop down menu to “set every frame”

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

---

<div class="post-metadata">

### Author: ![niras](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@niras](https://discourse.psychopy.org/u/niras)
#### Post date: [December 1, 2016, 1:58pm UTC](https://discourse.psychopy.org/t/animating-a-figure/1515/5 "2016-12-01T13:58:59Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)
#### Post date: [December 1, 2016, 2:14pm UTC](https://discourse.psychopy.org/t/animating-a-figure/1515/6 "2016-12-01T14:14:38Z")

</div>

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 😉

[http://discourse.psychopy.org/t/need-more-help-with-builder-come-to-the-workshop?source\_topic\_id=1515](http://discourse.psychopy.org/t/need-more-help-with-builder-come-to-the-workshop?source_topic_id=1515)

---

<div class="post-metadata">

### Author: ![niras](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@niras](https://discourse.psychopy.org/u/niras)
#### Post date: [December 1, 2016, 2:35pm UTC](https://discourse.psychopy.org/t/animating-a-figure/1515/7 "2016-12-01T14:35:22Z")

</div>

Brilliant.  
Thank you so much!  
(And while I have the chance - thank you also for creating this awesome tool 🙂 )  
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?
