extends Control
class_name Transition

signal game_fully_hidden
signal game_fully_visible

@onready var label: Label = $Label
@onready var animation_player: AnimationPlayer = $AnimationPlayer

@export var text: String:
	set(new_value):
		label.text = new_value
	get:
		return label.text

func slide_in():
	animation_player.play("slide-in")
	await animation_player.animation_finished
	game_fully_hidden.emit()

func slide_out():
	animation_player.play("slide-out")
	await animation_player.animation_finished
	game_fully_visible.emit()

func transition(display_text: String = ""):
	text = display_text
	slide_in()
	await get_tree().create_timer(2).timeout
	slide_out()
