Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird animation behavior inside containers #43

Closed
smedelyan opened this issue Aug 28, 2024 · 4 comments · Fixed by #44
Closed

Weird animation behavior inside containers #43

smedelyan opened this issue Aug 28, 2024 · 4 comments · Fixed by #44

Comments

@smedelyan
Copy link

smedelyan commented Aug 28, 2024

Hi. I tried to see what happens when I put an Anima-animated Control inside a container (which handles the position and size itself), and it does not appear to work as expected. Or maybe I'm missing something?

GIF

anima_weird_container_behavior

My expectation is that the label bounces upon it's initial position, but it's not. It drops to the bottom of the screen. It works the same both in Editor and in running game.

Another issue is that changes to the container size are not respected. E.g. if I resize the window, the "center" label can get out of screen or be not stick to e.g. bottom of the screen to where it is (wrongly) put by "bounce" animation.

I tried to work around this by putting this label into another intermediate container or inside a plain Control, but neither of these workarounds work.

Godot version: 4.2.2
Anima version: latest main branch

ceceppa added a commit that referenced this issue Aug 30, 2024
@ceceppa
Copy link
Owner

ceceppa commented Aug 30, 2024

I managed to reproduce this issue when the window was resized... Doing some investigation on the root cause

@ceceppa
Copy link
Owner

ceceppa commented Aug 30, 2024

I found the root cause.
Anima stores some info (i.e., initial position) inside the Node's metadata. This data is because:

  1. Playing the same animation again or in the loop will be faster; no calculation is needed
  2. It Is needed to be able to play the same animation backwards

In your case, you were testing using the keyword "@tool.". So, Anima stored that info according to the editor's viewport size. So, if the scene had a different size, it would cause that issue. Same if you resized the editor.

I've fixed this behavior in #44, which now uses different keys for the metadata according to the fact that you're running inside the editor or as a scene. Also, editor metadata is now cleared before each run.

I've recreated your example in this test scene: https://github.com/ceceppa/anima/blob/main/tests/Test.tscn

Let me know if you're still experiencing the same issue

@ceceppa ceceppa reopened this Aug 30, 2024
@ceceppa ceceppa closed this as completed Aug 30, 2024
@smedelyan
Copy link
Author

Thanks, it works now!

P. S. The Test.tscn is not openable due to missing script:
image

@ceceppa
Copy link
Owner

ceceppa commented Sep 2, 2024

Pushed the missing script :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants