animacions de INIT_HUD amb control d'inici i final

This commit is contained in:
2025-12-16 09:39:53 +01:00
parent 8b896912b2
commit c959e0e3a0
4 changed files with 139 additions and 46 deletions

View File

@@ -131,10 +131,24 @@ constexpr float LEVEL_COMPLETED_DURATION = 3.0f; // Duración total
constexpr float LEVEL_COMPLETED_TYPING_RATIO = 0.0f; // 0.0 = sin typewriter (directo)
// Transición INIT_HUD (animación inicial del HUD)
constexpr float INIT_HUD_DURATION = 3.0f; // Duración total del estado
constexpr float INIT_HUD_RECT_RATIO = 0.67f; // Proporción animación rectángulo
constexpr float INIT_HUD_SCORE_RATIO = 0.83f; // Proporción animación marcador
constexpr float INIT_HUD_SHIP_RATIO = 1.0f; // Proporción animación nave
constexpr float INIT_HUD_DURATION = 3.0f; // Duración total del estado
// Ratios de animación (inicio y fin como porcentajes del tiempo total)
// RECT (rectángulo de marges)
constexpr float INIT_HUD_RECT_RATIO_INIT = 0.33f;
constexpr float INIT_HUD_RECT_RATIO_END = 1.0f;
// SCORE (marcador de puntuación)
constexpr float INIT_HUD_SCORE_RATIO_INIT = 0.17f;
constexpr float INIT_HUD_SCORE_RATIO_END = 1.0f;
// SHIP1 (nave jugador 1)
constexpr float INIT_HUD_SHIP1_RATIO_INIT = 0.0f;
constexpr float INIT_HUD_SHIP1_RATIO_END = 1.0f;
// SHIP2 (nave jugador 2)
constexpr float INIT_HUD_SHIP2_RATIO_INIT = 0.20f;
constexpr float INIT_HUD_SHIP2_RATIO_END = 1.0f;
// Posición inicial de la nave en INIT_HUD (75% de altura de zona de juego)
constexpr float INIT_HUD_SHIP_START_Y_RATIO = 0.75f; // 75% desde el top de PLAYAREA

View File

@@ -12,6 +12,30 @@ inline float ease_out_quad(float t) {
return 1.0f - (1.0f - t) * (1.0f - t);
}
// Ease-in quadratic: empieza lento, acelera
// t = progreso normalizado [0.0 - 1.0]
// retorna valor interpolado [0.0 - 1.0]
inline float ease_in_quad(float t) {
return t * t;
}
// Ease-in-out quadratic: acelera al inicio, desacelera al final
// t = progreso normalizado [0.0 - 1.0]
// retorna valor interpolado [0.0 - 1.0]
inline float ease_in_out_quad(float t) {
return (t < 0.5f)
? 2.0f * t * t
: 1.0f - (-2.0f * t + 2.0f) * (-2.0f * t + 2.0f) / 2.0f;
}
// Ease-out cubic: desaceleración más suave que quadratic
// t = progreso normalizado [0.0 - 1.0]
// retorna valor interpolado [0.0 - 1.0]
inline float ease_out_cubic(float t) {
float t1 = 1.0f - t;
return 1.0f - t1 * t1 * t1;
}
// Interpolación lineal básica (para referencia)
inline float lerp(float start, float end, float t) {
return start + (end - start) * t;