From bdddeeaf66f2779e1cd8ea2e3c1d51ca717f34d0 Mon Sep 17 00:00:00 2001 From: Eric Smith <5d@fifthdread.com> Date: Wed, 20 May 2026 22:05:54 -0400 Subject: [PATCH] fix: animate actual font size via tween_method instead of broken Control scale --- scenes/splash.gd | 46 +++++++++++++++++++++++++++------------------- scenes/splash.tscn | 40 +++++++++++++++------------------------- 2 files changed, 42 insertions(+), 44 deletions(-) diff --git a/scenes/splash.gd b/scenes/splash.gd index e00ebff..ed13701 100644 --- a/scenes/splash.gd +++ b/scenes/splash.gd @@ -1,45 +1,47 @@ extends Control -@onready var unit: Control = %Unit +@onready var vbox: VBoxContainer = %VBox +@onready var v_label: Label = %VLabel +@onready var panel_label: Label = %PanelLabel @onready var transition_overlay: ColorRect = %TransitionOverlay +const V_START_SIZE: int = 48 +const V_END_SIZE: int = 512 +const P_START_SIZE: int = 28 +const P_END_SIZE: int = 288 + func _ready() -> void: if not Engine.is_editor_hint(): get_window().mode = Window.MODE_FULLSCREEN - # Start with unit invisible and overlay black - unit.modulate = Color(1, 1, 1, 0) + # Start invisible and at tiny font size + vbox.modulate = Color(1, 1, 1, 0) + v_label.add_theme_font_size_override("normal_font_size", V_START_SIZE) + panel_label.add_theme_font_size_override("normal_font_size", P_START_SIZE) transition_overlay.color = Color(0, 0, 0, 1) - # Wait one frame for layout to resolve await get_tree().process_frame - # Pivot at center of the whole unit so zoom comes from middle - unit.pivot_offset = unit.size * 0.5 - - # Initial tiny scale — done after layout so pivot_offset is valid - unit.scale = Vector2(0.05, 0.05) - - # Fade overlay away (reveal splash on a clean 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: Dramatic zoom in + fade in (whole unit scales as one) - var zoom_in := create_tween() - zoom_in.set_parallel(true) - zoom_in.tween_property(unit, "modulate", Color(1, 1, 1, 1), 1.8).set_ease(Tween.EASE_OUT) - zoom_in.tween_property(unit, "scale", Vector2(1.0, 1.0), 2.0).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK) - await zoom_in.finished + # Phase 1: Grow font sizes + fade in (parallel) + 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 # Phase 2: Hold await get_tree().create_timer(1.0).timeout # Phase 3: Fade out var fade_out := create_tween() - fade_out.tween_property(unit, "modulate", Color(1, 1, 1, 0), 0.8).set_ease(Tween.EASE_IN) + 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 @@ -54,7 +56,13 @@ func _ready() -> void: from_black.tween_property(transition_overlay, "color", Color(0, 0, 0, 0), 0.6) await from_black.finished - # Reparent dashboard to scene root so it survives splash's queue_free remove_child(dashboard) get_tree().root.add_child(dashboard) queue_free() + + +func _set_sizes(progress: float) -> void: + var v_size: int = int(round(V_START_SIZE + progress * (V_END_SIZE - V_START_SIZE))) + var p_size: int = int(round(P_START_SIZE + progress * (P_END_SIZE - P_START_SIZE))) + v_label.add_theme_font_size_override("normal_font_size", v_size) + panel_label.add_theme_font_size_override("normal_font_size", p_size) diff --git a/scenes/splash.tscn b/scenes/splash.tscn index ac9180e..129abc9 100644 --- a/scenes/splash.tscn +++ b/scenes/splash.tscn @@ -30,27 +30,21 @@ anchor_bottom = 1.0 mouse_filter = 2 color = Color(0.08, 0.08, 0.12, 1.0) -[node name="Unit" type="Control" parent="."] -unique_name_in_owner = true -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -600.0 -offset_top = -410.0 -offset_right = 600.0 -offset_bottom = 410.0 +[node name="Center" type="CenterContainer" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 mouse_filter = 2 -[node name="VLabel" type="Label" parent="Unit"] -layout_mode = 0 -offset_left = 0.0 -offset_top = 0.0 -offset_right = 1200.0 -offset_bottom = 520.0 +[node name="VBox" type="VBoxContainer" parent="Center"] +unique_name_in_owner = true +layout_mode = 2 +theme_override_constants/separation = 0 + +[node name="VLabel" type="Label" parent="Center/VBox"] +unique_name_in_owner = true +layout_mode = 2 theme_override_fonts/normal_font = SubResource("FontVariation_ijphb") -theme_override_font_sizes/normal_font_size = 512 theme_override_colors/font_color = Color(0.933, 0.271, 0.376, 1.0) theme_override_constants/outline_size = 12 theme_override_colors/font_outline_color = Color(0.0, 0.0, 0.0, 0.6) @@ -58,14 +52,10 @@ text = "V" horizontal_alignment = 1 vertical_alignment = 1 -[node name="PanelLabel" type="Label" parent="Unit"] -layout_mode = 0 -offset_left = 0.0 -offset_top = 520.0 -offset_right = 1200.0 -offset_bottom = 820.0 +[node name="PanelLabel" type="Label" parent="Center/VBox"] +unique_name_in_owner = true +layout_mode = 2 theme_override_fonts/normal_font = SubResource("FontVariation_boeqg") -theme_override_font_sizes/normal_font_size = 288 theme_override_colors/font_color = Color(0.7, 0.7, 0.8, 1.0) theme_override_constants/outline_size = 8 theme_override_colors/font_outline_color = Color(0.0, 0.0, 0.0, 0.5)