40 lines
975 B
GDScript
40 lines
975 B
GDScript
extends CenterContainer
|
|
@export var dotRadius: float = 1
|
|
@export var dotColor: Color = Color.WHITE
|
|
|
|
var current_radius: float
|
|
var is_highlighted: bool = false
|
|
var tween: Tween
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
queue_redraw()
|
|
pass # Replace with function body.
|
|
|
|
# This function is called by the Camera script
|
|
func set_highlight(active: bool) -> void:
|
|
is_highlighted = active
|
|
_animate_radius()
|
|
queue_redraw()
|
|
|
|
func _animate_radius():
|
|
# Kill any existing tween so they don't fight each other
|
|
if tween and tween.is_running():
|
|
tween.kill()
|
|
|
|
tween = create_tween()
|
|
|
|
# Determine target based on state
|
|
var target = dotRadius * 3 if is_highlighted else dotRadius
|
|
|
|
# Transition from current_radius to target over 0.3 seconds
|
|
tween.tween_property(self, "current_radius", target, 0.1)\
|
|
.set_trans(Tween.TRANS_SINE)\
|
|
.set_ease(Tween.EASE_OUT)
|
|
|
|
|
|
func _draw():
|
|
draw_circle(Vector2(0,0),current_radius,dotColor)
|