11 lines
504 B
GDScript
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)
|