class_name LobbyDecor extends Node @export var refLobby : Lobby; @export var bg : TextureRect; @export var logoOffset : int; @export var mainCamera : Node3D; @onready var guiTexture : TextureRect = get_node("c_GUITexture"); func _ready(): var screen_size = get_viewport().get_visible_rect().size if Time.get_ticks_msec() > 6000: guiTexture.modulate.a = 0; elif bg: _set_pixelinset(bg, Rect2(0, 0, screen_size.x, screen_size.y)); func _process(_delta : float): var screen_size = get_viewport().get_visible_rect().size var t_elapsed : float = float(Time.get_ticks_msec()) / float(1000); var width = screen_size.y * .84; if width > 600: width -= (width - 600) * .5; if width > screen_size.x - 30: width = screen_size.x - 30; if t_elapsed > 1.5 && \ !mainCamera.get_node("c_Audio Source").playing && \ PlayerPrefs.GetInt("useMusic", 1) != 0: mainCamera.get_node("c_Audio Source").playing = true; if t_elapsed < 5: bg.modulate.a = 1.4 - (t_elapsed / 4); if t_elapsed < 2.5: guiTexture.modulate.a = lerpf(0, 1.2, t_elapsed * (1 / 2.5)); _set_pixelinset(guiTexture, Rect2( screen_size.x / 2 - width / 2, screen_size.y / 2 - width / 4, width, width / 2)); if t_elapsed > 4.25: _set_pixelinset(guiTexture, Rect2( screen_size.x / 2 - width / 2, _easeOutExpo( t_elapsed - 4.25, screen_size.y / 2 - width / 4, screen_size.y - (width / 2), .75), width, width / 2)); elif t_elapsed > 6: if bg: bg.queue_free(); guiTexture.modulate.a = lerpf(guiTexture.modulate.a, refLobby.GUIAlpha - .2, _delta * 4); _set_pixelinset(guiTexture, Rect2( screen_size.x / 2 - width / 2, screen_size.y - (width / 2), width, width / 2)); logoOffset = width / 2; ## time, begin, change, duration func _easeOutExpo(t, b, c, d): c = c - b; return c * (-pow(2, -10 * t/d) + 1) + b; func _easeInOutExpo(t, b, c, d): c = c - b; if t < d/2: return 2*c*t*t/(d*d) + b; var ts = t - d/2; return -2*c*ts*ts/(d*d) + 2*c*ts/d + c/2 + b; func _set_pixelinset(trect : TextureRect, rect : Rect2): var screen_size = get_viewport().get_visible_rect().size; trect.position.x = rect.position.x; trect.position.y = screen_size.y - (rect.position.y + rect.size.y); trect.size.x = rect.size.x; trect.size.y = rect.size.y;