extends CanvasLayer

signal has_faded

@onready var color = $Color
@onready var animationPlayer = $AnimationPlayer

func _ready():
	color.hide()

func fade():
	color.show()
	animationPlayer.play("fade_out")

func _on_animation_player_animation_finished(anim_name: StringName) -> void:
	if anim_name == "fade_out":
		has_faded.emit()
		animationPlayer.play("fade_in")
	elif anim_name == "fade_in":
		color.hide()

func isAnimating():
	return animationPlayer.is_playing()
