imgui_utils: expose lerp values to BREATHE_MOTION macro

This commit is contained in:
Hyper 2025-01-29 07:18:36 +00:00
parent d5d2e83a10
commit 863e1602ff
4 changed files with 4 additions and 4 deletions

View file

@ -81,7 +81,7 @@ static void DrawSelectionContainer(ImVec2 min, ImVec2 max)
auto drawList = ImGui::GetForegroundDrawList();
static auto breatheStart = ImGui::GetTime();
auto alpha = BREATHE_MOTION(breatheStart, 0.92f);
auto alpha = BREATHE_MOTION(1.0f, 0.65f, breatheStart, 0.92f);
auto colour = IM_COL32(255, 255, 255, 255 * alpha);
auto commonWidth = Scale(11);

View file

@ -15,7 +15,7 @@
#define CENTRE_TEXT_HORZ(min, max, textSize) min.x + ((max.x - min.x) - textSize.x) / 2
#define CENTRE_TEXT_VERT(min, max, textSize) min.y + ((max.y - min.y) - textSize.y) / 2
#define BREATHE_MOTION(start, rate) Lerp(1.0f, 0.55f, (sin((ImGui::GetTime() - start) * (2.0f * M_PI / rate)) + 1.0f) / 2.0f)
#define BREATHE_MOTION(start, end, time, rate) Lerp(start, end, (sin((ImGui::GetTime() - time) * (2.0f * M_PI / rate)) + 1.0f) / 2.0f)
inline void SetGradient(const ImVec2& min, const ImVec2& max, ImU32 top, ImU32 bottom)
{

View file

@ -588,7 +588,7 @@ static void DrawScanlineBars()
{
// Breathing animation
static auto breatheStart = ImGui::GetTime();
breatheMotion = BREATHE_MOTION(breatheStart, 1.5f);
breatheMotion = BREATHE_MOTION(1.0f, 0.55f, breatheStart, 1.5f);
}
DrawTextWithOutline

View file

@ -216,7 +216,7 @@ void DrawButton(int rowIndex, float yOffset, float width, float height, std::str
if (isSelected)
{
static auto breatheStart = ImGui::GetTime();
auto alpha = BREATHE_MOTION(breatheStart, 0.92f);
auto alpha = BREATHE_MOTION(1.0f, 0.55f, breatheStart, 0.92f);
auto colour = IM_COL32(255, 255, 255, 255 * alpha);
auto width = Scale(11);