extends Node
class="hl-commentclass="hl-string">"># Punch scale (e.g., coin pickup, button press)
static func punch_scale(node: Node, strength := class="hl-number">1.3, duration := class="hl-number">0.3):
var tween = node.create_tween()
tween.tween_property(node, "scaleclass="hl-string">", Vector2.ONE * strength, duration * class="hl-number">0.4)
tween.tween_property(node, "scaleclass="hl-string">", Vector2.ONE, duration * class="hl-number">0.6).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_ELASTIC)
class="hl-commentclass="hl-string">"># Fade in
static func fade_in(node: CanvasItem, duration := class="hl-number">0.5):
node.modulate.a = class="hl-number">0.0
var tween = node.create_tween()
tween.tween_property(node, "modulate:aclass="hl-string">", class="hl-number">1.0, duration)
class="hl-commentclass="hl-string">"># Slide in from direction
static func slide_in(node: Control, from_offset := Vector2(class="hl-number">0, class="hl-number">30), duration := class="hl-number">0.4):
var target_pos = node.position
node.position += from_offset
node.modulate.a = class="hl-number">0.0
var tween = node.create_tween().set_parallel(true)
tween.tween_property(node, "positionclass="hl-string">", target_pos, duration).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CUBIC)
tween.tween_property(node, "modulate:aclass="hl-string">", class="hl-number">1.0, duration * class="hl-number">0.6)
class="hl-commentclass="hl-string">"># Bounce (e.g., notification)
static func bounce(node: Node, height := class="hl-number">20.0, duration := class="hl-number">0.5):
var tween = node.create_tween()
tween.tween_property(node, "position:yclass="hl-string">", node.position.y - height, duration * class="hl-number">0.4).set_ease(Tween.EASE_OUT)
tween.tween_property(node, "position:y", node.position.y, duration * class="hl-number">0.6).set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_BOUNCE)