add ui component
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
class_name AnimatedVisibiltyComponent extends Area2D
|
||||
|
||||
|
||||
var visibility_tween:Tween
|
||||
@export var visibility_tween_duration:float
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
mouse_entered.connect(_on_hover.bind(true))
|
||||
mouse_exited.connect(_on_hover.bind(false))
|
||||
modulate.a = 0
|
||||
|
||||
|
||||
func _on_hover(hover):
|
||||
if visibility_tween:
|
||||
visibility_tween.kill()
|
||||
visibility_tween = create_tween()
|
||||
|
||||
if hover:
|
||||
visibility_tween.tween_property(self,"modulate:a",255,visibility_tween_duration)
|
||||
else:
|
||||
visibility_tween.tween_property(self,"modulate:a",0,visibility_tween_duration)
|
||||
Reference in New Issue
Block a user