You wouldn't use a while for this. If you are calling it in _process() or _physics_process(), then whatever code is running (whether in a loop or not) is considered only for the next frame. What you could do is change the "while" to an "if" and then it will rotate a little bit each frame until it's done. A better way would be to use Tweens or the AnimationPlayer.