system
1
|
|
|
|
Reply From: |
Skyfrit |
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.)
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)
tween.start()
func _on_Tween_tween_step( object, key, elapsed, value ):
progressbar.update()
system
5
|
|
|
|
Reply From: |
CakeLover |
I used this:
extends ProgressBar
func _set(property:String,val):
if(property=="value"):
value=val
self.get("custom_styles/fg").set_bg_color(Color(
1.0 if ratio<0.5 else (2 - 2*ratio),
1.0 if ratio>0.5 else (2*ratio),
0,1
))
it gave me clear bright colors like this:
Hope it helps