0 votes

I'm rotating a 2dnode by using 'rotation += speed * delta '. The rotation will happen only if I pressed the space button. The problem is I want to make a slow out motion, in which the object will stop rotating after a short period and its speed will gradually decrease to zero.
Is there any good way to do that?
Thanks for the help. :)

in Engine by (325 points)

oh, I think I found the problem. I put a while loop into the _process function.

1 Answer

+1 vote
Best answer

Maybe it's a little rough, but try animating the Node2D by rect_rotation in a loop and then doing something like:

func _spacereleased()
    var slow = 1
    while true:
        yield(get_tree().create_timer(0.1), "timeout")
        slow = slow - 0.1
        $AnimatedPlayer.playback_speed = slow
by (96 points)
selected by
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 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 webmaster@godotengine.org with your username.