From 9b3e549876cdf6a2a6f5b53d97d9a825bf93525a Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 2 Oct 2024 18:00:21 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adidas=20funciones=20de=20suavizado=20a?= =?UTF-8?q?=20utils.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/utils.cpp | 12 ++++++++++++ source/utils.h | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/source/utils.cpp b/source/utils.cpp index 50b85d3..38c66ab 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -3,6 +3,7 @@ #include // for max, min #include // for isspace #include // for distance +#include struct JA_Music_t; // lines 3-3 struct JA_Sound_t; // lines 4-4 @@ -309,4 +310,15 @@ std::string trim(const std::string &str) } while (std::distance(start, end) > 0 && std::isspace(*end)); return std::string(start, end + 1); +} + +// Función de suavizado +double easeOutQuint(double t) +{ + return 1 - std::pow(1 - t, 5); +} + +// Función de suavizado +double easeInOutSine(double t) { + return -0.5 * (std::cos(M_PI * t) - 1); } \ No newline at end of file diff --git a/source/utils.h b/source/utils.h index 98b1729..54ea480 100644 --- a/source/utils.h +++ b/source/utils.h @@ -305,6 +305,12 @@ color_t DarkenColor(color_t color, int amount); // Quita los espacioes en un string std::string trim(const std::string &str); +// Función de suavizado +double easeOutQuint(double t); + +// Función de suavizado +double easeInOutSine(double t); + // Colores extern const color_t bgColor; extern const color_t noColor;