feat(ultrasound): add UltrasoundMachine component with continuous heartbeat animation

This commit is contained in:
Steven Wroblewski
2026-04-17 16:29:10 +02:00
parent a8bc3123ac
commit a94cf61b79
2 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
## UltrasoundMachine — displays a continuous heartbeat pulse on the screen.
class_name UltrasoundMachine extends Node2D
const BEAT_RISE_DURATION: float = 0.12
const BEAT_FALL_DURATION: float = 0.12
const BEAT_INTERVAL: float = 0.60
const BEAT_SCALE_PEAK: Vector2 = Vector2(1.5, 1.5)
const BEAT_SCALE_REST: Vector2 = Vector2(1.0, 1.0)
func _ready() -> void:
_start_heartbeat_loop()
func _start_heartbeat_loop() -> void:
var dot: Node2D = get_node_or_null("HeartbeatDot") as Node2D
if dot == null:
return
var tween: Tween = create_tween()
tween.set_loops()
tween.tween_property(dot, "scale", BEAT_SCALE_PEAK, BEAT_RISE_DURATION)
tween.tween_property(dot, "scale", BEAT_SCALE_REST, BEAT_FALL_DURATION)
tween.tween_interval(BEAT_INTERVAL)