extends CanvasLayer

func _ready():
	$AnimationPlayer.play_backwards("dissolve")

var transitioning: bool

func change_scene(target: PackedScene) -> void:
	if transitioning:
		return
	transitioning = true
	$AnimationPlayer.play("dissolve")
	await $AnimationPlayer.animation_finished
	get_tree().change_scene_to_packed(target)
	$AnimationPlayer.play_backwards("dissolve")
	await $AnimationPlayer.animation_finished
	transitioning = false

func change_volume(value: float):
	var volume = log(value) / log(10) * 20
	AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), volume)
