This commit is contained in:
TinyHerm committed 2026-11-24 23:40:08 +03:00
commit 1c7a8cf25f
579 files changed
+83196

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
using System;
using System.Drawing;
namespace VibranceHud.Zoom;
internal static class ZoomMath
{
public const float MinLevel = 1.5f;
public const float MaxLevel = 4f;
public const float Step = 0.25f;
public const float DefaultLevel = 2f;
public static float ClampSetting(float level)
{
if (float.IsNaN(level) || float.IsInfinity(level))
{
return 2f;
}
level = Math.Clamp(level, 1.5f, 4f);
return (float)(Math.Round(level / 0.25f, MidpointRounding.AwayFromZero) * 0.25);
}
public static (int X, int Y) CentreOffsets(Rectangle bounds, float level)
{
if (!(level > 1f))
{
return (X: 0, Y: 0);
}
double num = (1.0 - 1.0 / (double)level) / 2.0;
return (X: bounds.Left + (int)((double)bounds.Width * num), Y: bounds.Top + (int)((double)bounds.Height * num));
}
public static float Ease(float from, float to, float t)
{
if (!(t < 1f))
{
return to;
}
if (t <= 0f)
{
return from;
}
float num = 1f - t;
return from + (to - from) * (1f - num * num * num);
}
}