fix: scale labels directly with centered pivot for reliable zoom animation
This commit is contained in:
parent
932e7b660c
commit
6c955da9de
2 changed files with 45 additions and 21 deletions
|
|
@ -1,7 +1,9 @@
|
|||
extends Control
|
||||
|
||||
|
||||
@onready var text_container: VBoxContainer = %TextContainer
|
||||
@onready var logo: Control = %Logo
|
||||
@onready var v_label: Label = %VLabel
|
||||
@onready var panel_label: Label = %PanelLabel
|
||||
@onready var transition_overlay: ColorRect = %TransitionOverlay
|
||||
|
||||
|
||||
|
|
@ -9,14 +11,20 @@ func _ready() -> void:
|
|||
if not Engine.is_editor_hint():
|
||||
get_window().mode = Window.MODE_FULLSCREEN
|
||||
|
||||
# Initial state: hidden text container, black overlay
|
||||
text_container.modulate = Color(1, 1, 1, 0)
|
||||
text_container.scale = Vector2(0.05, 0.05)
|
||||
# Start with text invisible and overlay black
|
||||
logo.modulate = Color(1, 1, 1, 0)
|
||||
transition_overlay.color = Color(0, 0, 0, 1)
|
||||
|
||||
# Let the layout settle
|
||||
# Wait one frame for layout to resolve
|
||||
await get_tree().process_frame
|
||||
await get_tree().create_timer(0.2).timeout
|
||||
|
||||
# Set pivot to center of each label so scale is centered
|
||||
v_label.pivot_offset = v_label.size * 0.5
|
||||
panel_label.pivot_offset = panel_label.size * 0.5
|
||||
|
||||
# Set initial tiny scale — done after layout so pivot_offset is valid
|
||||
v_label.scale = Vector2(0.05, 0.05)
|
||||
panel_label.scale = Vector2(0.05, 0.05)
|
||||
|
||||
# Fade overlay away (reveal splash on a clean background)
|
||||
var reveal := create_tween()
|
||||
|
|
@ -26,8 +34,9 @@ func _ready() -> void:
|
|||
# Phase 1: Dramatic zoom in + fade in
|
||||
var zoom_in := create_tween()
|
||||
zoom_in.set_parallel(true)
|
||||
zoom_in.tween_property(text_container, "modulate", Color(1, 1, 1, 1), 1.8).set_ease(Tween.EASE_OUT)
|
||||
zoom_in.tween_property(text_container, "scale", Vector2(1.0, 1.0), 2.0).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
|
||||
zoom_in.tween_property(logo, "modulate", Color(1, 1, 1, 1), 1.8).set_ease(Tween.EASE_OUT)
|
||||
zoom_in.tween_property(v_label, "scale", Vector2(1.0, 1.0), 2.0).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
|
||||
zoom_in.tween_property(panel_label, "scale", Vector2(1.0, 1.0), 2.0).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
|
||||
await zoom_in.finished
|
||||
|
||||
# Phase 2: Hold
|
||||
|
|
@ -35,7 +44,7 @@ func _ready() -> void:
|
|||
|
||||
# Phase 3: Fade out
|
||||
var fade_out := create_tween()
|
||||
fade_out.tween_property(text_container, "modulate", Color(1, 1, 1, 0), 0.8).set_ease(Tween.EASE_IN)
|
||||
fade_out.tween_property(logo, "modulate", Color(1, 1, 1, 0), 0.8).set_ease(Tween.EASE_IN)
|
||||
await fade_out.finished
|
||||
|
||||
# Phase 4: Crossfade to dashboard
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue