0 votes

I have a progress bar within canvas layer. I want to change the color...as the time goes low. How can i do this? thanks

in Engine by (74 points)

1 Answer

+4 votes

You can change the foreground and background color in Inspector panel.(If it doesn'n update in the editor, try change the progress bar value.)

enter image description here
And you can use Tween or AnimationPlayer to change color as the time goes low.

func _ready():
    tween.interpolate_method(progressbar.get("custom_styles/fg"), "set_bg_color", Color("0081ff"), Color("ffffff"), 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)

func _on_Tween_tween_step( object, key, elapsed, value ):
by (598 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.