+1 vote

What's the best way to have my buttons transition between normal/focused/hovered with a fade animation?

Preferably so I can choose which scenes this effect will happen on.

Godot version 3.5.1
in Engine by (30 points)

Maybe you can use the signals on the Texture Button to detect what kind of UI changed occurred (lost/gained focus, stopped hovering, pressed, etc etc) and animate a Texture Rect associated with the Texture Button (instead of directly animating the Texture Button, because I am not seeing how to directly animate the texture of a texture button without animating the whole button)

This works but I need it on a regular button, I don't think it's possible though

A regular button has the same signals as a texture button, and instead of using an icon for the button you can use a texture rect that is childed to the button, and handle the animations in your own way using an animation player

Oh wow that works perfectly thank you!

Awesome! That's good to hear because when I first read your question I was pretty stumped to be honest. I'm going to add an answer now so this doesn't appear in the "unanswered" section anymore

1 Answer

0 votes

Like we discussed in the replies, for future readers, the solution was to use the signals from the button node to keep track of UI events (focus lost/gained, mouse hovering or not, etc), and then use an animation player node in conjunction with a childed texture rect to make custom animations

by (177 points)

Okay one problem, I thought the animation player could fade between textures but it can't, I instead used 2 texture rects and used a tween on the 2nd rect's modulate alpha channel and it works, I'll see if I have a problem with this method

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 Frequently asked questions and 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 [email protected] with your username.