tojam20-elevator/scripts/ui_utils.gd
2026-05-10 23:56:09 +01:00

11 lines
504 B
GDScript

class_name UIUtils
static func flip_label_text(label: Label, new_text: String, duration: float = 0.15) -> void:
label.pivot_offset = Vector2(0, label.size.y)
var tween = label.create_tween()
tween.tween_property(label, "scale:y", 0.0, duration).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_IN)
tween.tween_callback(func():
label.text = new_text
label.pivot_offset = Vector2.ZERO
)
tween.tween_property(label, "scale:y", 1.0, duration).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_OUT)