checheche/Robo-Bus-A31-HMI/code/hsliderPor.gd
2024-12-06 21:22:11 +08:00

23 lines
679 B
GDScript

extends HSlider
@export var texture1 :Texture= null;
@export var texture2 :Texture= null;
func _physics_process(delta: float) -> void:
if value > max_value/2:
set("theme_override_icons/grabber",texture1)
set("theme_override_icons/grabber_highlight",texture1)
else:
set("theme_override_icons/grabber",texture2)
set("theme_override_icons/grabber_highlight",texture2)
func _on_drag_ended(value_changed: bool) -> void:
if value > max_value/2:
var tween = get_tree().create_tween()
tween.tween_property(self, "value", max_value, 0.1)
else:
var tween = get_tree().create_tween()
tween.tween_property(self, "value", 0, 0.1)
pass # Replace with function body.