mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Revert "clamp value of all easings by default"
This reverts commit 1aada98393.
Breaks the API.
This commit is contained in:
parent
0cac90b032
commit
b36bdb2086
17 changed files with 35 additions and 41 deletions
|
|
@ -43,15 +43,9 @@ public abstract class Easing
|
|||
public bool IsInverse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current value of the animation, from 0 to 1.
|
||||
/// Gets or sets the current value of the animation, from 0 to 1.
|
||||
/// </summary>
|
||||
public double Value => Math.Clamp(this.ValueUnclamped, 0, 1);
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public double ValueUnclamped
|
||||
public double Value
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ public class InCirc : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = 1 - Math.Sqrt(1 - Math.Pow(p, 2));
|
||||
this.Value = 1 - Math.Sqrt(1 - Math.Pow(p, 2));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ public class InCubic : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = p * p * p;
|
||||
this.Value = p * p * p;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ public class InElastic : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = p == 0
|
||||
? 0
|
||||
: p == 1
|
||||
? 1
|
||||
: -Math.Pow(2, (10 * p) - 10) * Math.Sin(((p * 10) - 10.75) * Constant);
|
||||
this.Value = p == 0
|
||||
? 0
|
||||
: p == 1
|
||||
? 1
|
||||
: -Math.Pow(2, (10 * p) - 10) * Math.Sin(((p * 10) - 10.75) * Constant);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ public class InOutCirc : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ public class InOutCubic : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = p < 0.5 ? 4 * p * p * p : 1 - (Math.Pow((-2 * p) + 2, 3) / 2);
|
||||
this.Value = p < 0.5 ? 4 * p * p * p : 1 - (Math.Pow((-2 * p) + 2, 3) / 2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ public class InOutElastic : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ public class InOutQuint : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = p < 0.5 ? 16 * p * p * p * p * p : 1 - (Math.Pow((-2 * p) + 2, 5) / 2);
|
||||
this.Value = p < 0.5 ? 16 * p * p * p * p * p : 1 - (Math.Pow((-2 * p) + 2, 5) / 2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ public class InOutSine : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = -(Math.Cos(Math.PI * p) - 1) / 2;
|
||||
this.Value = -(Math.Cos(Math.PI * p) - 1) / 2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ public class InQuint : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = p * p * p * p * p;
|
||||
this.Value = p * p * p * p * p;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ public class InSine : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = 1 - Math.Cos((p * Math.PI) / 2);
|
||||
this.Value = 1 - Math.Cos((p * Math.PI) / 2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ public class OutCirc : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = Math.Sqrt(1 - Math.Pow(p - 1, 2));
|
||||
this.Value = Math.Sqrt(1 - Math.Pow(p - 1, 2));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ public class OutCubic : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = 1 - Math.Pow(1 - p, 3);
|
||||
this.Value = 1 - Math.Pow(1 - p, 3);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ public class OutElastic : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = p == 0
|
||||
? 0
|
||||
: p == 1
|
||||
? 1
|
||||
: (Math.Pow(2, -10 * p) * Math.Sin(((p * 10) - 0.75) * Constant)) + 1;
|
||||
this.Value = p == 0
|
||||
? 0
|
||||
: p == 1
|
||||
? 1
|
||||
: (Math.Pow(2, -10 * p) * Math.Sin(((p * 10) - 0.75) * Constant)) + 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ public class OutQuint : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = 1 - Math.Pow(1 - p, 5);
|
||||
this.Value = 1 - Math.Pow(1 - p, 5);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ public class OutSine : Easing
|
|||
public override void Update()
|
||||
{
|
||||
var p = this.Progress;
|
||||
this.ValueUnclamped = Math.Sin((p * Math.PI) / 2);
|
||||
this.Value = Math.Sin((p * Math.PI) / 2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
|
||||
this.fadeOutEasing.Update();
|
||||
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)this.fadeOutEasing.Value))
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)Math.Max(this.fadeOutEasing.Value, 0)))
|
||||
{
|
||||
var i = 0;
|
||||
foreach (var entry in entries)
|
||||
|
|
@ -393,7 +393,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
|
||||
if (overrideAlpha)
|
||||
{
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, showText ? (float)logoEasing.Value : 0f);
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, showText ? (float)Math.Min(logoEasing.Value, 1) : 0f);
|
||||
}
|
||||
|
||||
// Drop shadow
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue