diff --git a/Dalamud/Interface/Animation/Easing.cs b/Dalamud/Interface/Animation/Easing.cs
index c6d6149af..a48300a22 100644
--- a/Dalamud/Interface/Animation/Easing.cs
+++ b/Dalamud/Interface/Animation/Easing.cs
@@ -1,14 +1,11 @@
using System.Diagnostics;
using System.Numerics;
-using Dalamud.Utility;
-
namespace Dalamud.Interface.Animation;
///
/// Base class facilitating the implementation of easing functions.
///
-[Api12ToDo("Re-apply https://github.com/goatcorp/Dalamud/commit/1aada983931d9e45a250eebbc17c8b782d07701b")]
public abstract class Easing
{
// TODO: Use game delta time here instead
@@ -46,9 +43,15 @@ public abstract class Easing
public bool IsInverse { get; set; }
///
- /// Gets or sets the current value of the animation, from 0 to 1.
+ /// Gets the current value of the animation, from 0 to 1.
///
- public double Value
+ public double Value => Math.Clamp(this.ValueUnclamped, 0, 1);
+
+ ///
+ /// Gets or sets the current value of the animation, not limited to a range of 0 to 1.
+ /// Will return numbers outside of this range if accessed beyond animation time.
+ ///
+ public double ValueUnclamped
{
get
{
diff --git a/Dalamud/Interface/Animation/EasingFunctions/InCirc.cs b/Dalamud/Interface/Animation/EasingFunctions/InCirc.cs
index c467104c5..d94e9fc9f 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/InCirc.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/InCirc.cs
@@ -19,6 +19,6 @@ public class InCirc : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = 1 - Math.Sqrt(1 - Math.Pow(p, 2));
+ this.ValueUnclamped = 1 - Math.Sqrt(1 - Math.Pow(p, 2));
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/InCubic.cs b/Dalamud/Interface/Animation/EasingFunctions/InCubic.cs
index 78f6774ac..64ebc5ba3 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/InCubic.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/InCubic.cs
@@ -19,6 +19,6 @@ public class InCubic : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = p * p * p;
+ this.ValueUnclamped = p * p * p;
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/InElastic.cs b/Dalamud/Interface/Animation/EasingFunctions/InElastic.cs
index c53c3d587..2e834e41c 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/InElastic.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/InElastic.cs
@@ -21,10 +21,10 @@ public class InElastic : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = p == 0
- ? 0
- : p == 1
- ? 1
- : -Math.Pow(2, (10 * p) - 10) * Math.Sin(((p * 10) - 10.75) * Constant);
+ this.ValueUnclamped = p == 0
+ ? 0
+ : p == 1
+ ? 1
+ : -Math.Pow(2, (10 * p) - 10) * Math.Sin(((p * 10) - 10.75) * Constant);
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/InOutCirc.cs b/Dalamud/Interface/Animation/EasingFunctions/InOutCirc.cs
index 71a598dfb..a63ab648a 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/InOutCirc.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/InOutCirc.cs
@@ -19,8 +19,8 @@ public class InOutCirc : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = p < 0.5
- ? (1 - Math.Sqrt(1 - Math.Pow(2 * p, 2))) / 2
- : (Math.Sqrt(1 - Math.Pow((-2 * p) + 2, 2)) + 1) / 2;
+ this.ValueUnclamped = p < 0.5
+ ? (1 - Math.Sqrt(1 - Math.Pow(2 * p, 2))) / 2
+ : (Math.Sqrt(1 - Math.Pow((-2 * p) + 2, 2)) + 1) / 2;
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/InOutCubic.cs b/Dalamud/Interface/Animation/EasingFunctions/InOutCubic.cs
index 07bcfa28d..4083265b7 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/InOutCubic.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/InOutCubic.cs
@@ -19,6 +19,6 @@ public class InOutCubic : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = p < 0.5 ? 4 * p * p * p : 1 - (Math.Pow((-2 * p) + 2, 3) / 2);
+ this.ValueUnclamped = p < 0.5 ? 4 * p * p * p : 1 - (Math.Pow((-2 * p) + 2, 3) / 2);
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/InOutElastic.cs b/Dalamud/Interface/Animation/EasingFunctions/InOutElastic.cs
index f78f9f336..f27726038 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/InOutElastic.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/InOutElastic.cs
@@ -21,12 +21,12 @@ public class InOutElastic : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = p == 0
- ? 0
- : p == 1
- ? 1
- : p < 0.5
- ? -(Math.Pow(2, (20 * p) - 10) * Math.Sin(((20 * p) - 11.125) * Constant)) / 2
- : (Math.Pow(2, (-20 * p) + 10) * Math.Sin(((20 * p) - 11.125) * Constant) / 2) + 1;
+ this.ValueUnclamped = p == 0
+ ? 0
+ : p == 1
+ ? 1
+ : p < 0.5
+ ? -(Math.Pow(2, (20 * p) - 10) * Math.Sin(((20 * p) - 11.125) * Constant)) / 2
+ : (Math.Pow(2, (-20 * p) + 10) * Math.Sin(((20 * p) - 11.125) * Constant) / 2) + 1;
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/InOutQuint.cs b/Dalamud/Interface/Animation/EasingFunctions/InOutQuint.cs
index 64ab98b16..e08129b25 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/InOutQuint.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/InOutQuint.cs
@@ -19,6 +19,6 @@ public class InOutQuint : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = p < 0.5 ? 16 * p * p * p * p * p : 1 - (Math.Pow((-2 * p) + 2, 5) / 2);
+ this.ValueUnclamped = p < 0.5 ? 16 * p * p * p * p * p : 1 - (Math.Pow((-2 * p) + 2, 5) / 2);
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/InOutSine.cs b/Dalamud/Interface/Animation/EasingFunctions/InOutSine.cs
index 2f347ff80..cb940d87d 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/InOutSine.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/InOutSine.cs
@@ -19,6 +19,6 @@ public class InOutSine : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = -(Math.Cos(Math.PI * p) - 1) / 2;
+ this.ValueUnclamped = -(Math.Cos(Math.PI * p) - 1) / 2;
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/InQuint.cs b/Dalamud/Interface/Animation/EasingFunctions/InQuint.cs
index a5ab5a22c..827e0e21b 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/InQuint.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/InQuint.cs
@@ -19,6 +19,6 @@ public class InQuint : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = p * p * p * p * p;
+ this.ValueUnclamped = p * p * p * p * p;
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/InSine.cs b/Dalamud/Interface/Animation/EasingFunctions/InSine.cs
index fa079baad..61affa10a 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/InSine.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/InSine.cs
@@ -19,6 +19,6 @@ public class InSine : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = 1 - Math.Cos((p * Math.PI) / 2);
+ this.ValueUnclamped = 1 - Math.Cos((p * Math.PI) / 2);
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/OutCirc.cs b/Dalamud/Interface/Animation/EasingFunctions/OutCirc.cs
index b0d3b895a..980e29a81 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/OutCirc.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/OutCirc.cs
@@ -19,6 +19,6 @@ public class OutCirc : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = Math.Sqrt(1 - Math.Pow(p - 1, 2));
+ this.ValueUnclamped = Math.Sqrt(1 - Math.Pow(p - 1, 2));
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/OutCubic.cs b/Dalamud/Interface/Animation/EasingFunctions/OutCubic.cs
index 9c1bb57dc..e1a79c35b 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/OutCubic.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/OutCubic.cs
@@ -19,6 +19,6 @@ public class OutCubic : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = 1 - Math.Pow(1 - p, 3);
+ this.ValueUnclamped = 1 - Math.Pow(1 - p, 3);
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/OutElastic.cs b/Dalamud/Interface/Animation/EasingFunctions/OutElastic.cs
index 6a4fcd6dc..1f525b404 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/OutElastic.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/OutElastic.cs
@@ -21,10 +21,10 @@ public class OutElastic : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = p == 0
- ? 0
- : p == 1
- ? 1
- : (Math.Pow(2, -10 * p) * Math.Sin(((p * 10) - 0.75) * Constant)) + 1;
+ this.ValueUnclamped = p == 0
+ ? 0
+ : p == 1
+ ? 1
+ : (Math.Pow(2, -10 * p) * Math.Sin(((p * 10) - 0.75) * Constant)) + 1;
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/OutQuint.cs b/Dalamud/Interface/Animation/EasingFunctions/OutQuint.cs
index a3174e762..24a2255d3 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/OutQuint.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/OutQuint.cs
@@ -19,6 +19,6 @@ public class OutQuint : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = 1 - Math.Pow(1 - p, 5);
+ this.ValueUnclamped = 1 - Math.Pow(1 - p, 5);
}
}
diff --git a/Dalamud/Interface/Animation/EasingFunctions/OutSine.cs b/Dalamud/Interface/Animation/EasingFunctions/OutSine.cs
index ba82232b3..a376d7f57 100644
--- a/Dalamud/Interface/Animation/EasingFunctions/OutSine.cs
+++ b/Dalamud/Interface/Animation/EasingFunctions/OutSine.cs
@@ -19,6 +19,6 @@ public class OutSine : Easing
public override void Update()
{
var p = this.Progress;
- this.Value = Math.Sin((p * Math.PI) / 2);
+ this.ValueUnclamped = Math.Sin((p * Math.PI) / 2);
}
}
diff --git a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs
index ce8c192a4..c1f0b2a67 100644
--- a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs
@@ -251,7 +251,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
this.fadeOutEasing.Update();
- using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)Math.Max(this.fadeOutEasing.Value, 0)))
+ using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)this.fadeOutEasing.Value))
{
var i = 0;
foreach (var entry in entries)
@@ -392,7 +392,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
if (overrideAlpha)
{
- ImGui.PushStyleVar(ImGuiStyleVar.Alpha, showText ? (float)Math.Min(logoEasing.Value, 1) : 0f);
+ ImGui.PushStyleVar(ImGuiStyleVar.Alpha, showText ? (float)logoEasing.Value : 0f);
}
// Drop shadow