0 votes

Hi! Here I found how to open popup with animation. But how to do same on closeing? I tried this:

func popup_hide():
    var tween : Tween = get_node("Tween")
    tween.interpolate_property(self, "modulate:a", self.modulate.a, 0.0, 0.3, Tween.TRANS_LINEAR, Tween.EASE_IN)
   tween.start()

But it doesn't work for me. It looks like I should to run animation and use popup.hide() only after it. But how to use it for non-exlusive popups? Or are there other way?

Thanks

Godot version 3.3.2
in Engine by (102 points)

What is your working code to open it?

(Sorry putting this as an answer. Fat fingers.)

Why you put it into answer, not comment?

Okay.

func _ready():
    connect("about_to_show", self, "_on_about_to_show")
    ...

func _on_about_to_show():
    var tw = Tween.new()
    add_child(tw)
    tw.interpolate_property(self, "modulate:a", 0.0, 0.99, 0.2, Tween.TRANS_LINEAR, Tween.EASE_IN)
    tw.start()

1 Answer

0 votes

Popups aren't really meant to have a closing animation. I think it would be easier for you to just use a normal panel or something like that to animate it closing.

by (7,190 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 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.