1
0
mirror of synced 2024-11-14 19:17:39 +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;
}
}
}