27 lines
688 B
C#
27 lines
688 B
C#
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|