# ANOTHER problem with flipping animations

**URL:** https://forum.makecode.com/t/another-problem-with-flipping-animations/11293
**Category:** Help
**Created:** [December 9, 2021, 11:37pm UTC](https://forum.makecode.com/t/another-problem-with-flipping-animations/11293 "2021-12-09T23:37:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![TheJaky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thejaky/32/5711_2.png) [@TheJaky](https://forum.makecode.com/u/TheJaky)
#### Post date: [December 9, 2021, 11:37pm UTC](https://forum.makecode.com/t/another-problem-with-flipping-animations/11293/1 "2021-12-09T23:37:26Z")

</div>

So, I already know how to flip animations. (I had help solving this here: [Problem with flipping animations](https://forum.makecode.com/t/problem-with-flipping-animations/11159))

But I have a lot of animations to flip. Like a LOT LOT. I tried to make a function that would flip any animation that you put into it, and it failed ☹

![Screenshot 2021-12-09 3.45.50 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/6/620831e776b54ade97a8ec817c9d76afde1d02bc.png)

So when the function is called, it also sets the 4 other variables

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/0/0a9d90ed464397bb809f04b1ba8f65fb41c9f5bf.png)

The animation is an array and the first thing (in this case the animation is called gank spank, I was tired)

The second one is just whatever sprite you want to apply the flipped animation to, and here it’s the player

The third one is just the interval at which the animation plays

and the last one is supposed to determine whether the animation is a loop or not

But when I tested the code, it said that it “cannot read properties of undefined (reading iface)”

I don’t know what iface is or what is undefined. I need help with this, please!

---

<div class="post-metadata">

### Author: ![drtongue96](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@drtongue96](https://forum.makecode.com/u/drtongue96)
#### Post date: [December 10, 2021, 4:03pm UTC](https://forum.makecode.com/t/another-problem-with-flipping-animations/11293/4 "2021-12-10T16:03:43Z")

</div>

tried it myself. got it to work. just don’t clone the photo (for some reason it didn’t work)

> **[testanimations](https://arcade.makecode.com/88201-75268-13350-00094)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)
#### Post date: [December 10, 2021, 4:03pm UTC](https://forum.makecode.com/t/another-problem-with-flipping-animations/11293/5 "2021-12-10T16:03:44Z")

</div>

I just use the velocity stuff. That’s my best bet. I do that to be safe to avoid these super complex situations. (Just a suggestion)

---

<div class="post-metadata">

### Author: ![TheJaky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thejaky/32/5711_2.png) [@TheJaky](https://forum.makecode.com/u/TheJaky)
#### Post date: [December 10, 2021, 5:43pm UTC](https://forum.makecode.com/t/another-problem-with-flipping-animations/11293/6 "2021-12-10T17:43:48Z")

</div>

happy birthday drtongue96 😃

but your solution didn’t really work, it kind of just has the same problems as my first post about flipping animations…

---

<div class="post-metadata">

### Author: ![drtongue96](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@drtongue96](https://forum.makecode.com/u/drtongue96)
#### Post date: [December 10, 2021, 6:54pm UTC](https://forum.makecode.com/t/another-problem-with-flipping-animations/11293/7 "2021-12-10T18:54:08Z")

</div>

It worked. Passed in the animation and it reversed it. What you could do is create a less complicated function to pass in an animation and then in the function itself RETURN the reversed one, then you don’t need all those extra parameters.

---

<div class="post-metadata">

### Author: ![TheJaky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thejaky/32/5711_2.png) [@TheJaky](https://forum.makecode.com/u/TheJaky)
#### Post date: [December 10, 2021, 7:37pm UTC](https://forum.makecode.com/t/another-problem-with-flipping-animations/11293/8 "2021-12-10T19:37:12Z")

</div>

well for me, it just flipped it everytime the button was pressed

---

<div class="post-metadata">

### Author: ![TheJaky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thejaky/32/5711_2.png) [@TheJaky](https://forum.makecode.com/u/TheJaky)
#### Post date: [December 10, 2021, 7:37pm UTC](https://forum.makecode.com/t/another-problem-with-flipping-animations/11293/9 "2021-12-10T19:37:13Z")

</div>

also what does the return function block do? I never got to figuring that out.
