建锅资源分享
رفتن به کانال در Telegram
1 658
مشترکین
+724 ساعت
+387 روز
+9630 روز
آرشیو پست ها
1 658
static float g_MainAnimStart = -1.0f; static int g_MainAnimLastFrame = -1; static int g_MainAnimIndex = 0; bool g_上升动画 = true; static void MainAnim_Begin() { int frame = ImGui::GetFrameCount(); if (g_MainAnimLastFrame != -1 && frame != g_MainAnimLastFrame + 1) { g_MainAnimStart = -1.0f; } g_MainAnimLastFrame = frame; if (g_MainAnimStart < 0.0f) g_MainAnimStart = ImGui::GetTime(); g_MainAnimIndex = 0; } static float BindAnimY(float targetY) { if (!g_上升动画) { g_MainAnimIndex++; return targetY; } const int groupSize = 3; const float delayFactor = 1.2f; const float baseDelay = 0.125f; const float animDuration = 0.8f; int groupIndex = g_MainAnimIndex / groupSize; g_MainAnimIndex++; float elapsed = ImGui::GetTime() - g_MainAnimStart; float t = (elapsed - groupIndex * delayFactor * baseDelay) / animDuration; if (t < 0.0f) t = 0.0f; if (t > 1.0f) t = 1.0f; float u = 1.0f - t; float eased = 1.0f - u * u * u * u * u; float startY = ImGui::GetIO().DisplaySize.y; return startY + (targetY - startY) * eased; }//上升动画调用如下 MainAnim_Begin();//加你菜单Begin内 ImGui::SetCursorPosY(BindAnimY(ImGui::GetCursorPosY() + 0.0f));//加你控件内类似如下 ImGui::SetCursorPosY(BindAnimY(ImGui::GetCursorPosY() + 0.0f)); Toggle("事例", 事例, 340, 35); By。豆包ai,
