onboarding close button

This commit is contained in:
Nordup 2025-08-12 23:22:51 +07:00
parent 9e46290c36
commit 3131b731e0
7 changed files with 126 additions and 9 deletions

View file

@ -0,0 +1,34 @@
extends Button
@export var content: Control
@export var tween_duration: float
@export var base_modulate: Color
@export var hover_scale: float
var tween: Tween
func _ready() -> void:
mouse_entered.connect(on_mouse_entered)
mouse_exited.connect(on_mouse_exited)
on_mouse_exited()
func on_mouse_entered() -> void:
if is_instance_valid(tween): tween.stop()
tween = create_tween()
tween.set_parallel(true)
tween.set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
tween.tween_property(content, "scale", Vector2.ONE * hover_scale, tween_duration)
tween.tween_property(content, "modulate", Color.WHITE, tween_duration)
func on_mouse_exited() -> void:
if is_instance_valid(tween): tween.stop()
tween = create_tween()
tween.set_parallel(true)
tween.set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
tween.tween_property(content, "scale", Vector2.ONE, tween_duration)
tween.tween_property(content, "modulate", base_modulate, tween_duration)