mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat(Easing): add IsRunning, IsDone
This commit is contained in:
parent
0a35700ee3
commit
cb85f8d49a
1 changed files with 12 additions and 1 deletions
|
|
@ -9,6 +9,7 @@ namespace Dalamud.Interface.Animation
|
|||
/// </summary>
|
||||
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
|
|||
/// </summary>
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether or not the animation is running.
|
||||
/// </summary>
|
||||
public bool IsRunning => this.animationTimer.IsRunning;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether or not the animation is done.
|
||||
/// </summary>
|
||||
public bool IsDone => this.animationTimer.ElapsedMilliseconds > this.Duration.TotalMilliseconds;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the progress of the animation, from 0 to 1.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue