ld-56/components/Menu/background_highlight.gd
2024-10-06 04:22:46 -04:00

35 lines
929 B
GDScript

extends ColorRect
var tween
func _on_mouse_handler_hovered() -> void:
if tween:
tween.kill()
tween = create_tween()
tween.set_ease(Tween.EASE_OUT)
tween.set_trans(Tween.TRANS_BACK)
tween.tween_property(self, "position:x", -136, 0.5)
tween.set_ease(Tween.EASE_IN_OUT)
tween.set_trans(Tween.TRANS_QUAD)
tween.tween_property(self, "position:x", -128, 0.25)
tween.set_ease(Tween.EASE_IN_OUT)
tween.tween_property(self, "position:x", -132, 0.25)
tween.tween_callback(func():
tween = create_tween()
tween.set_loops()
tween.set_ease(Tween.EASE_IN_OUT)
tween.set_trans(Tween.TRANS_QUAD)
tween.tween_property(self, "position:x", -136, 1)
tween.tween_property(self, "position:x", -132, 1)
)
func _on_mouse_handler_unhovered() -> void:
if tween:
tween.kill()
tween = create_tween()
tween.set_ease(Tween.EASE_OUT)
tween.set_trans(Tween.TRANS_BACK)
tween.tween_property(self, "position:x", -420, 0.5)