clean: Eliminar logging debug + fix: Centro fijo para animación ZOOM

**1. Eliminado logging de debug del FADE_OUT:**
- Removido log de timer/delta_time/progress (FADE_OUT inicial)
- Removido log de alpha1/alpha2
- Removido log de animaciones (ZOOM, ELASTIC, SPIRAL, BOUNCE)
- Removido log de completado de FADE_OUT
- Consola limpia en modo producción

**2. Fix centro del logo en animación ZOOM_ONLY:**

**Problema:**
- Centro del logo se calculaba basándose en width/height escalados
- Cuando scale cambiaba (1.2 → 1.0), corner_x/corner_y se movían
- Resultado: logo se desplazaba lateralmente durante zoom

**Solución:**
- Calcular esquina BASE (sin escala): corner_x_base, corner_y_base
- Calcular centro FIJO basándose en base_width/base_height
- Calcular width/height escalados DESPUÉS (solo para vértices)
- Resultado: centro permanece fijo, zoom crece/decrece alrededor del centro

**Archivos modificados:**
- source/app_logo.cpp:
  - Líneas 343-347: Eliminado log FADE_OUT inicial
  - Línea 347: Eliminado log completado
  - Líneas 365-366: Eliminado log alphas
  - Líneas 381-383: Eliminado log ZOOM
  - Líneas 396-398: Eliminado log ELASTIC
  - Líneas 414-417: Eliminado log SPIRAL
  - Líneas 444-446: Eliminado log BOUNCE
  - Líneas 609-625: Reordenado cálculo de centro (FIJO) y tamaño (ESCALADO)

**Resultado esperado:**
- Sin spam en consola
- Animación ZOOM perfectamente centrada en esquina inferior derecha
- Logo crece/decrece sin desplazamiento lateral

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-18 19:40:53 +02:00
parent 5a35cc1abf
commit db8acf0331
3 changed files with 14 additions and 37 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 123 KiB

View File

@@ -343,15 +343,8 @@ void AppLogo::update(float delta_time, AppMode current_mode) {
float fade_progress_logo1 = timer_ / APPLOGO_ANIMATION_DURATION;
float fade_progress_logo2 = std::max(0.0f, (timer_ - APPLOGO_LOGO2_DELAY) / APPLOGO_ANIMATION_DURATION);
// LOG: Estado completo de FADE_OUT para diagnóstico
std::cout << "[FADE_OUT] timer=" << timer_
<< " | delta_time=" << delta_time
<< " | prog1=" << fade_progress_logo1
<< " | prog2=" << fade_progress_logo2 << std::endl;
// Verificar si fade out completado (cuando logo2 también termina)
if (fade_progress_logo2 >= 1.0f) {
std::cout << " [FADE_OUT COMPLETADO - Cambiando a HIDDEN]" << std::endl;
// Fade out completado, volver a HIDDEN
state_ = AppLogoState::HIDDEN;
timer_ = 0.0f;
@@ -371,9 +364,6 @@ void AppLogo::update(float delta_time, AppMode current_mode) {
logo1_alpha_ = static_cast<int>((1.0f - std::min(1.0f, fade_progress_logo1)) * 255.0f);
logo2_alpha_ = static_cast<int>((1.0f - std::min(1.0f, fade_progress_logo2)) * 255.0f);
std::cout << " → alpha1=" << logo1_alpha_
<< " | alpha2=" << logo2_alpha_ << std::endl;
// ================================================================
// Aplicar MISMA animación (current_animation_) de forma invertida
// ================================================================
@@ -388,9 +378,6 @@ void AppLogo::update(float delta_time, AppMode current_mode) {
logo2_squash_y_ = 1.0f;
logo2_stretch_x_ = 1.0f;
logo2_rotation_ = 0.0f;
std::cout << " → ZOOM: scale1=" << logo1_scale_
<< " | scale2=" << logo2_scale_ << std::endl;
break;
case AppLogoAnimationType::ELASTIC_STICK:
@@ -406,10 +393,6 @@ void AppLogo::update(float delta_time, AppMode current_mode) {
logo2_squash_y_ = 1.0f + (prog2 * 0.3f);
logo2_stretch_x_ = 1.0f - (prog2 * 0.2f);
logo2_rotation_ = prog2 * 0.1f;
std::cout << " → ELASTIC: scale1=" << logo1_scale_
<< " | squash1=" << logo1_squash_y_
<< " | stretch1=" << logo1_stretch_x_ << std::endl;
}
break;
@@ -428,10 +411,6 @@ void AppLogo::update(float delta_time, AppMode current_mode) {
logo2_rotation_ = prog2 * 6.28f;
logo2_squash_y_ = 1.0f;
logo2_stretch_x_ = 1.0f;
std::cout << " → SPIRAL: scale1=" << logo1_scale_
<< " | rotation1=" << logo1_rotation_
<< " | ease_t1=" << ease_t1 << std::endl;
}
break;
@@ -462,9 +441,6 @@ void AppLogo::update(float delta_time, AppMode current_mode) {
}
logo2_scale_ = 1.0f + (prog2 * 0.3f);
logo2_rotation_ = 0.0f;
std::cout << " → BOUNCE: scale1=" << logo1_scale_
<< " | squash1=" << logo1_squash_y_ << std::endl;
}
break;
}
@@ -630,22 +606,23 @@ void AppLogo::renderWithGeometry(int logo_index) {
float alpha_normalized = static_cast<float>(alpha) / 255.0f; // Convertir 0-255 → 0.0-1.0
// NO usar SDL_SetTextureAlphaMod - aplicar alpha directamente a vértices
// Calcular tamaño con escala y deformaciones aplicadas
// (base_width y base_height ya están pre-escalados al tamaño correcto de pantalla)
float width = base_width * scale * stretch_x;
float height = base_height * scale * squash_y;
// Calcular padding desde bordes derecho e inferior
float padding_x = screen_width_ * APPLOGO_PADDING_PERCENT;
float padding_y = screen_height_ * APPLOGO_PADDING_PERCENT;
// Calcular esquina del logo (anclado a esquina inferior derecha con padding)
float corner_x = screen_width_ - width - padding_x;
float corner_y = screen_height_ - height - padding_y;
// Calcular esquina BASE (sin escala) para obtener centro FIJO
// Esto asegura que el centro no se mueva cuando cambia scale/squash/stretch
float corner_x_base = screen_width_ - base_width - padding_x;
float corner_y_base = screen_height_ - base_height - padding_y;
// Centro del logo (para rotación) = esquina + mitad del tamaño
float center_x = corner_x + (width / 2.0f);
float center_y = corner_y + (height / 2.0f);
// Centro FIJO del logo (no cambia con scale/squash/stretch)
float center_x = corner_x_base + (base_width / 2.0f);
float center_y = corner_y_base + (base_height / 2.0f);
// Calcular tamaño ESCALADO (para vértices)
// (base_width y base_height ya están pre-escalados al tamaño correcto de pantalla)
float width = base_width * scale * stretch_x;
float height = base_height * scale * squash_y;
// Pre-calcular seno y coseno de rotación
float cos_rot = cosf(rotation);

View File

@@ -291,9 +291,9 @@ constexpr int LOGO_FLIP_WAIT_PROBABILITY = 50; // 50% probabilidad de el
// Configuración de AppLogo (logo periódico en pantalla)
constexpr float APPLOGO_DISPLAY_INTERVAL = 2.0f; // Intervalo entre apariciones del logo (segundos)
constexpr float APPLOGO_DISPLAY_DURATION = 4.0f; // Duración de visibilidad del logo (segundos)
constexpr float APPLOGO_ANIMATION_DURATION = 2.0f; // Duración de animación entrada/salida (segundos)
constexpr float APPLOGO_ANIMATION_DURATION = 0.5f; // Duración de animación entrada/salida (segundos)
constexpr float APPLOGO_HEIGHT_PERCENT = 0.4f; // Altura del logo = 40% de la altura de pantalla
constexpr float APPLOGO_PADDING_PERCENT = 0.1f; // Padding desde esquina inferior-derecha = 10%
constexpr float APPLOGO_PADDING_PERCENT = 0.05f; // Padding desde esquina inferior-derecha = 10%
constexpr float APPLOGO_LOGO2_DELAY = 0.25f; // Retraso de Logo 2 respecto a Logo 1 (segundos)
// Configuración de Modo BOIDS (comportamiento de enjambre)