Created
October 16, 2021 17:21
-
-
Save xorus/19afecd653d5bfff88bf4656a1f13a3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Dalamud.Interface.Animation; | |
namespace EngageTimer.UI.CustomEasing | |
{ | |
public class CubicBezier : Easing | |
{ | |
private readonly double _p0; | |
private readonly double _p1; | |
private readonly double _p2; | |
private readonly double _p3; | |
public CubicBezier(TimeSpan duration, double p0, double p1, double p2, double p3) : base(duration) | |
{ | |
_p0 = p0; | |
_p1 = p1; | |
_p2 = p2; | |
_p3 = p3; | |
} | |
public override void Update() | |
{ | |
this.Value = Math.Clamp(Math.Pow(1 - Progress, 2) * _p0 | |
+ 3 * Math.Pow(1 - Progress, 2) * Progress * _p1 | |
+ 3 * (1 - Progress) * Math.Pow(Progress, 2) * _p2 | |
+ Math.Pow(Progress, 3) * _p3, 0d, 1d); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment