Animation keeps playing

Hello!
Pretty much I have an animation to where when you press Space, a panel comes down, and when you press Space again, it goes up. I have both the animations working, but when the second animation ends (when the panel goes back up), then the panel comes back down, which is the first animation.
Can anyone help? Thanks.

Hello Did you have the loop enabled on your Animations ???

Are you using transitions ? Make sure your parameters values are not set in a manner that these are triggering the first animation again!

or if you are using the Animation.Play Function then you must be triggering it from the Script again.

You need 4 animation states in your motion flow, or need to stop the animations at the last frame via code. The 4 states you would need if not using code is motionless up, moving down, motionless down, and moving up. Transition from the moving state into the motionless states. Only transition out of the motionless state IF space bar is pushed.
If down - transition into moving up, if up transition into moving down. Once the moving animations complete it auto transitions into motionless animation.

(I’m not a coder - this is only simple logic)