17 lines
410 B
GDScript3
17 lines
410 B
GDScript3
|
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)
|