# Hurry Curry! - a game about cooking # Copyright 2024 metamuffin # Copyright 2024 tpart # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, version 3 of the License only. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # class_name SceneTransition extends Control @onready var anim: AnimationPlayer = $AnimationPlayer var black = true var fading = false func _ready(): $ColorRect.visible = true func fade_in(): if fading: await anim.animation_finished if not black: push_error("already faded in"); return fading = true anim.play_backwards("fade") await anim.animation_finished self.mouse_filter = Control.MOUSE_FILTER_IGNORE fading = false; black = false func fade_out(): if fading: await anim.animation_finished if black: push_error("already faded out"); return fading = true self.mouse_filter = Control.MOUSE_FILTER_STOP anim.play("fade") await anim.animation_finished fading = false; black = true func _exit_tree(): if fading: push_error("SceneTransition destroyed while fading")