41. Tweens and temporary visual changes
func run() -> bool:
var label := Label.new()
label.text = "Fading notice"
add_child(label)
var animation: Tween = create_tween()
animation.tween_property(label, "modulate:a", 0.0, 0.02)
await animation.finished
var finished: bool = is_zero_approx(label.modulate.a)
label.queue_free()
return finishedcreate_tween binds the Tween to this node’s lifetime. tween_property animates a property. By default successive steps run in sequence; set_parallel or parallel changes grouping. await finished lets the caller wait for the complete sequence.
Only tween properties the target actually has. A Label has modulate; a plain Node does not. A PCA record proxy is not automatically a Tween target for a rendered mesh. Get the native node deliberately or use the appropriate PCA action.
Avoid two systems writing the same property each frame. A Tween cannot reliably win a tug of war with PCA’s active camera controller, animation system or GUI state updater. Restore temporary presentation from saved game state when needed.
