feat(Interface): add Easing, InOutCubic

This commit is contained in:
goat 2021-07-18 18:25:24 +02:00
parent 28e99f5e4d
commit 4031a702c1
No known key found for this signature in database
GPG key ID: F18F057873895461
2 changed files with 131 additions and 0 deletions

View file

@ -0,0 +1,28 @@
using System;
using Serilog;
namespace Dalamud.Interface.Animation.EasingFunctions
{
/// <summary>
/// Class providing an "InOutCubic" easing animation.
/// </summary>
public class InOutCubic : Easing
{
/// <summary>
/// Initializes a new instance of the <see cref="InOutCubic"/> class.
/// </summary>
/// <param name="duration">The duration of the animation.</param>
public InOutCubic(TimeSpan duration)
: base(duration)
{
// ignored
}
/// <inheritdoc/>
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);
}
}
}