refactor: crossfade splash→dashboard instead of fade to black

This commit is contained in:
Eric Smith 2026-05-20 22:34:39 -04:00
parent a6d4c290d3
commit 5c94f8bf8c

View file

@ -7,8 +7,6 @@ extends Control
@onready var transition_overlay: ColorRect = %TransitionOverlay
@onready var vbox: VBoxContainer = %VBox
var _elapsed: float = 0.0
var _animating: bool = false
var _v_start: int
var _v_end: int
var _p_start: int
@ -26,7 +24,6 @@ func _ready() -> void:
bg.color = ConfigManager.get_color("background_color", Color(0.08, 0.08, 0.12))
# Compute end font sizes as a large fraction of screen height.
# Use set() to go through the property system directly.
_v_end = maxi(1, int(screen_size.y * 0.28))
_p_end = maxi(1, int(screen_size.y * 0.15))
_v_start = 4
@ -39,41 +36,36 @@ func _ready() -> void:
await get_tree().process_frame
# Reveal background
# Reveal background (fade overlay away)
var reveal := create_tween()
reveal.tween_property(transition_overlay, "color", Color(0, 0, 0, 0), 0.4)
await reveal.finished
# Phase 1: Animate font sizes up + fade in
_elapsed = 0.0
_animating = true
var grow := create_tween()
grow.set_parallel(true)
grow.tween_method(_set_sizes, 0.0, 1.0, 2.0).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
grow.tween_property(vbox, "modulate", Color(1, 1, 1, 1), 1.8).set_ease(Tween.EASE_OUT)
await grow.finished
_animating = false
# Phase 2: Hold
await get_tree().create_timer(1.0).timeout
# Phase 3: Fade out
var fade_out := create_tween()
fade_out.tween_property(vbox, "modulate", Color(1, 1, 1, 0), 0.8).set_ease(Tween.EASE_IN)
await fade_out.finished
# Phase 4: Crossfade to dashboard
var to_black := create_tween()
to_black.tween_property(transition_overlay, "color", Color(0, 0, 0, 1), 0.3)
await to_black.finished
# Phase 3: Crossfade to dashboard
# The splash and dashboard share the same background color, so the
# transition is seamless — splash text fades out while dashboard
# modules materialise out of the same dark backdrop.
var dashboard := preload("res://scenes/dashboard.tscn").instantiate()
add_child(dashboard)
dashboard.modulate = Color(1, 1, 1, 0)
var from_black := create_tween()
from_black.tween_property(transition_overlay, "color", Color(0, 0, 0, 0), 0.6)
await from_black.finished
var crossfade := create_tween()
crossfade.set_parallel(true)
crossfade.tween_property(vbox, "modulate", Color(1, 1, 1, 0), 1.0).set_ease(Tween.EASE_IN)
crossfade.tween_property(dashboard, "modulate", Color(1, 1, 1, 1), 1.0).set_ease(Tween.EASE_OUT).set_delay(0.2)
await crossfade.finished
# Reparent dashboard from splash to root, then free splash.
remove_child(dashboard)
get_tree().root.add_child(dashboard)
queue_free()