|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
Yaann |
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!
|
|
|
|
Reply From: |
damantisshrimp |
If you want to make the popup fade in, you can interpolate the alpha value from 0.0 to 1.0.
- Add a
Tween
node to your popup.
- Connect the
about_to_show()
signal to your popup node
- 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)
- 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