0 votes

I have a popup that brings up using the popup function, but I want it to animate it when it comes up with like a fade in or something like that.
I tried to put an animationplayer on it and make it autoplay but it's not working, the only idea I have rn is using a script like this:

popup.popup();
popupanimation.Play("fade_in");

But I wanna know if there is anything integrated within the engine that simplifies this method?
Any help is appreciated!

asked May 23 in Engine by Yaann (71 points)

1 Answer

0 votes

If you want to make the popup fade in, you can interpolate the alpha value from 0.0 to 1.0.

  1. Add a Tween node to your popup.
  2. Connect the about_to_show() signal to your popup node
  3. In the connected method _on_MyPopUp_about_to_show, add the interpolation to your tween: tween.interpolate_property(self, "modulate:a", 0.0, 1.0, 0.3, Tween.TRANS_LINEAR, Tween.EASE_IN)
  4. Start the interpolation with tween.start()

You can read a bit more about tweens here: https://docs.godotengine.org/en/stable/getting_started/step_by_step/ui_code_a_life_bar.html

answered May 23 by damantisshrimp (14 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.