xiandie/scene/effect/黑屏转场.gd

17 lines
410 B
GDScript3
Raw Normal View History

2025-06-24 17:52:30 +00:00
extends CanvasLayer
func _ready() -> void:
layer = GlobalConfig.CANVAS_LAYER_EFFECT
func run_effect(half_duration := 0.7):
if not is_node_ready():
await ready
var rect = $ColorRect as ColorRect
var tween = create_tween()
rect.modulate.a = 0
tween.tween_property(rect, "modulate:a", 1.0, half_duration)
tween.tween_property(rect, "modulate:a", 0.0, half_duration)
tween.tween_callback(queue_free)