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

Stop method does nothing on a single animation document #20

Closed
giusdp opened this issue Jan 13, 2021 · 4 comments
Closed

Stop method does nothing on a single animation document #20

giusdp opened this issue Jan 13, 2021 · 4 comments
Assignees

Comments

@giusdp
Copy link

giusdp commented Jan 13, 2021

Hello, I'm probably having an uncommon use case in my hands. I have an aseprite document with a single animation of 5 frames that I want it to run just once. I thought about doing this:

animatedSprite.OnAnimationEnd += animatedSprite.Stop;

but the animation loops anyway. I later found out the Pause method, but again it loops anyway with that too.

EDIT:
I tried OnAnimationLoop and it worked. I thought that OnAnimationEnd would fire after the last frame, my bad.

@manbeardgames
Copy link
Collaborator

So, OnAnimationEnd is supposed to be for when the animation ends, and since a looping animation doesn't end, it's not called.

OnAnimationLoop was the correct call since it's called on the frame the animation loops back to the first frame.

In hindsight I can see how this would be confusing and definitely may need a change or better documentation.

As for one time animations that play and dont loop, check this out. If you end a tag name in Aseprite with [oneshot], then the processor will detect this and only play the animation once. So like if your animation is a door opening and the tag is called open_door, then rename the tag to open_door[oneshot], and it will only play once when called without looping. Note that to play it you still just call .Play("open_door"), the oneshot part is removed from the name.

@manbeardgames
Copy link
Collaborator

Just checked and the [oneshot] trick isn't in the documentation page at all, so I def need to update that

@giusdp
Copy link
Author

giusdp commented Jan 14, 2021

The [oneshot] trick is really neat. I will use that surely!
Thanks

@AristurtleDev
Copy link
Owner

Closing this issue, tracking will now be done in issue #43

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

No branches or pull requests

3 participants