Class LerpUtilities
Contains some utility functions related to the Linear Interpolation
Namespace: WeaverCore.Utilities
Assembly: WeaverCore.dll
Syntax
public static class LerpUtilities
Methods
| Edit this page View SourceAdjustTowards(float, float, float)
Will adjust from
a value to
a value by a set amount
Declaration
public static float AdjustTowards(float from, float to, float amount)
Parameters
Type | Name | Description |
---|---|---|
float | from | The value to adjust from |
float | to | The value to adjust to |
float | amount | The amount to move from the "from" value to the "to" value |
Returns
Type | Description |
---|---|
float | Returns the adjusted float value |
TimeLerp(float, float, Action<float>)
Will move from
a value to
a value at a rate of 1 unit per second.
Declaration
public static IEnumerator TimeLerp(float from, float to, Action<float> action)
Parameters
Type | Name | Description |
---|---|---|
float | from | The value to move from |
float | to | The value to move to |
Action<float> | action | The action that is called every frame until we get to the destination value |
Returns
Type | Description |
---|---|
IEnumerator |
TimeLerp(float, float, Func<float, bool>)
Will move from
a value to
a value at a rate of 1 unit per second.
Declaration
public static IEnumerator TimeLerp(float from, float to, Func<float, bool> action)
Parameters
Type | Name | Description |
---|---|---|
float | from | The value to move from |
float | to | The value to move to |
Func<float, bool> | action | The action that is called every frame until we get to the destination value. However, if the action returns false at any time, the interpolation routine is cancelled |
Returns
Type | Description |
---|---|
IEnumerator |
UnclampedInverseLerp(float, float, float)
Does the inverse of a linear intepolation between two floats (unclamped)
Declaration
public static float UnclampedInverseLerp(float a, float b, float v)
Parameters
Type | Name | Description |
---|---|---|
float | a | |
float | b | |
float | v |
Returns
Type | Description |
---|---|
float |
UnclampedLerp(float, float, float)
Interpolates between two floats (unclamped)
Declaration
public static float UnclampedLerp(float a, float b, float t)
Parameters
Type | Name | Description |
---|---|---|
float | a | |
float | b | |
float | t |
Returns
Type | Description |
---|---|
float |