installer_wizard: added breathing anim to title during installation

This commit is contained in:
Hyper 2025-01-29 07:13:47 +00:00
parent cb57e337b8
commit d5d2e83a10
4 changed files with 47 additions and 27 deletions

View file

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

View file

@ -15,6 +15,8 @@
#define CENTRE_TEXT_HORZ(min, max, textSize) min.x + ((max.x - min.x) - textSize.x) / 2 #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 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)
inline void SetGradient(const ImVec2& min, const ImVec2& max, ImU32 top, ImU32 bottom) inline void SetGradient(const ImVec2& min, const ImVec2& max, ImU32 top, ImU32 bottom)
{ {
auto callbackData = AddImGuiCallback(ImGuiCallback::SetGradient); auto callbackData = AddImGuiCallback(ImGuiCallback::SetGradient);

View file

@ -580,9 +580,27 @@ static void DrawScanlineBars()
SetShaderModifier(IMGUI_SHADER_MODIFIER_NONE); SetShaderModifier(IMGUI_SHADER_MODIFIER_NONE);
// Installer text // Installer text
const std::string &headerText = Localise(g_currentPage == WizardPage::Installing ? "Installer_Header_Installing" : "Installer_Header_Installer"); auto& headerText = Localise(g_currentPage == WizardPage::Installing ? "Installer_Header_Installing" : "Installer_Header_Installer");
auto alphaMotion = ComputeMotionInstaller(g_appearTime, g_disappearTime, TITLE_ANIMATION_TIME, TITLE_ANIMATION_DURATION); auto alphaMotion = ComputeMotionInstaller(g_appearTime, g_disappearTime, TITLE_ANIMATION_TIME, TITLE_ANIMATION_DURATION);
DrawTextWithOutline(g_dfsogeistdFont, Scale(42.0f), { g_aspectRatioOffsetX + Scale(285.0f), Scale(57.0f) }, IM_COL32(255, 195, 0, 255 * alphaMotion), headerText.c_str(), 4, IM_COL32(0, 0, 0, 255 * alphaMotion), IMGUI_SHADER_MODIFIER_TITLE_BEVEL); auto breatheMotion = 1.0f;
if (g_currentPage == WizardPage::Installing)
{
// Breathing animation
static auto breatheStart = ImGui::GetTime();
breatheMotion = BREATHE_MOTION(breatheStart, 1.5f);
}
DrawTextWithOutline
(
g_dfsogeistdFont,
Scale(42),
{ g_aspectRatioOffsetX + Scale(285), Scale(57) },
IM_COL32(255, 195, 0, 255 * alphaMotion * breatheMotion),
headerText.c_str(), 4,
IM_COL32(0, 0, 0, 255 * alphaMotion * breatheMotion),
IMGUI_SHADER_MODIFIER_TITLE_BEVEL
);
auto drawLine = [&](bool top) auto drawLine = [&](bool top)
{ {

View file

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