From cb85f8d49a8f5c8b64cafdbb320c61951fecde1b Mon Sep 17 00:00:00 2001
From: goat <16760685+goaaats@users.noreply.github.com>
Date: Sun, 18 Jul 2021 22:56:40 +0200
Subject: [PATCH] feat(Easing): add IsRunning, IsDone
---
Dalamud/Interface/Animation/Easing.cs | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/Dalamud/Interface/Animation/Easing.cs b/Dalamud/Interface/Animation/Easing.cs
index 1edebb69b..441108e6f 100644
--- a/Dalamud/Interface/Animation/Easing.cs
+++ b/Dalamud/Interface/Animation/Easing.cs
@@ -9,6 +9,7 @@ namespace Dalamud.Interface.Animation
///
public abstract class Easing
{
+ // TODO: Use game delta time here instead
private readonly Stopwatch animationTimer = new();
private double valueInternal;
@@ -45,7 +46,7 @@ namespace Dalamud.Interface.Animation
get => this.valueInternal;
protected set
{
- this.valueInternal = Math.Min(value, 1);
+ this.valueInternal = value;
if (this.Point1.HasValue && this.Point2.HasValue)
this.EasedPoint = AnimUtil.Lerp(this.Point1.Value, this.Point2.Value, (float)this.valueInternal);
@@ -57,6 +58,16 @@ namespace Dalamud.Interface.Animation
///
public TimeSpan Duration { get; set; }
+ ///
+ /// Gets a value indicating whether or not the animation is running.
+ ///
+ public bool IsRunning => this.animationTimer.IsRunning;
+
+ ///
+ /// Gets a value indicating whether or not the animation is done.
+ ///
+ public bool IsDone => this.animationTimer.ElapsedMilliseconds > this.Duration.TotalMilliseconds;
+
///
/// Gets the progress of the animation, from 0 to 1.
///