feat(Animation): add InOutCirc

This commit is contained in:
goat 2021-07-18 19:31:52 +02:00
parent d9b6a05fc5
commit 3ca6f5e942
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

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