+2 votes

I have an issue where I'm trying to code an animation to play, but I don't want it to be a looping animation. I want it to play from start to finish every time it's called while it isn't already playing.

But it doesn't seem to restart from the beginning, and I can't easily find any method for resetting or rewinding the time line of an animation.

in Engine by (5,264 points)

Hmm, the regular play() function of AnimationPlayer always starts at the beginning for me.

3 Answers

+3 votes
Best answer

Seek doesn't work?

by (689 points)
selected by

Ah, yes, missed that. I suppose it does, but it doesn't stop the animation player. I've found though that stop() in script by default will reset the animation, so it does the same as seek(0).

Thanks for pointing me to that. X)

+1 vote

AnimationPlayer method play() restarts animation if it was stopped

by (16 points)
+1 vote

For my case to correctly reset the animationSprite I had to set the frame back to 0.

animation_sprite.frame = 0


by (16 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.