1
0
mirror of synced 2024-12-13 08:11:07 +01:00
Switch-Toolbox/Switch_Toolbox_Library/Animations/AnimationRewrite/InterpolationHelper.cs

27 lines
688 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Toolbox.Library.Animations
{
public class InterpolationHelper
{
public static float Lerp(float LHS, float RHS, float Weight)
{
return LHS * (1 - Weight) + RHS * Weight;
}
public static float Herp(float LHS, float RHS, float LS, float RS, float Diff, float Weight)
{
float Result;
Result = LHS + (LHS - RHS) * (2 * Weight - 3) * Weight * Weight;
Result += (Diff * (Weight - 1)) * (LS * (Weight - 1) + RS * Weight);
return Result;
}
}
}