Add support for widget tweening

Signed-off-by: Ritchie Frodomar <alkalinethunder@gmail.com>
This commit is contained in:
Ritchie Frodomar 2024-08-01 16:08:19 -04:00
parent 344c1f682e
commit dc2df1b726
2 changed files with 13 additions and 6 deletions

View file

@ -2,15 +2,22 @@ using Microsoft.Xna.Framework;
namespace AcidicGUI.Animation;
internal sealed class Animation<TValue> : Animation where TValue : struct
internal sealed class Animation<TValue> : Animation
where TValue : struct
{
private readonly InterpolationFunction<TValue> interpolator;
private readonly TValue minValue;
private readonly TValue maxValue;
public Action<TValue>? UpdateCallback { get; set; }
public Animation(CurveFunction curve, float duration, InterpolationFunction<TValue> interpolator, TValue startValue, TValue endValue) : base(curve, duration)
public Animation(
CurveFunction curve,
float duration,
InterpolationFunction<TValue> interpolator,
TValue startValue,
TValue endValue
) : base(curve, duration)
{
this.interpolator = interpolator;
this.minValue = startValue;
@ -66,7 +73,7 @@ internal abstract class Animation
Complete();
}
}
internal void Cancel()
{
if (IsCancelled)

View file

@ -1,5 +1,5 @@
using AcidicGUI.Events;
using AcidicGUI.Animation;
using AcidicGUI.Events;
using AcidicGUI.Layout;
using AcidicGUI.Rendering;
using AcidicGUI.TextRendering;