Class ExMLerps
See ExM. This class contains functions related to lerping and smoothing.
Inheritance
System.Object
ExMLerps
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: cs.temp.dll.dll
Syntax
public static class ExMLerps
Methods
Bezier<T>(TEx<T>, TEx<T>, TEx<T>, TEx<Single>)
Perform a quadratic bezier interpolation.
Declaration
public static TEx<T> Bezier<T>(TEx<T> start, TEx<T> ctrl, TEx<T> end, TEx<float> time)
Parameters
Type |
Name |
Description |
TEx<T> |
start |
Starting point
|
TEx<T> |
ctrl |
Control point
|
TEx<T> |
end |
Ending point
|
TEx<System.Single> |
time |
0-1 lerp controller (automatically clamped)
|
Returns
Type Parameters
Bezier3<T>(TEx<T>, TEx<T>, TEx<T>, TEx<T>, TEx<Single>)
Perform a cubic bezier interpolation between points in N-dimensional space.
This is the same as CalcBezier in BagoumLib when start=0 and end=1.
This is not the same as the cubic bezier interpolation used in CSS and
most animation engines. For that functionality, use CubicBezier.
Declaration
public static TEx<T> Bezier3<T>(TEx<T> start, TEx<T> ctrl1, TEx<T> ctrl2, TEx<T> end, TEx<float> time)
Parameters
Type |
Name |
Description |
TEx<T> |
start |
Starting point
|
TEx<T> |
ctrl1 |
First control point
|
TEx<T> |
ctrl2 |
Second control point
|
TEx<T> |
end |
Ending point
|
TEx<System.Single> |
time |
0-1 lerp controller (automatically clamped)
|
Returns
Type Parameters
CubicBezier(ExBPY, ExBPY, ExBPY, ExBPY, ExBPY)
Perform a cubic bezier easing interpolation using the same logic as cubic-bezier in CSS.
This is significantly more computationally expensive than other bezier methods since it requires
calculating the roots of the bezier function.
For optimization purposes, it is required that both control coordinates reduce to constants.
Declaration
public static ExBPY CubicBezier(ExBPY time1, ExBPY prog1, ExBPY time2, ExBPY prog2, ExBPY time)
Parameters
Type |
Name |
Description |
ExBPY |
time1 |
Time of first control point
|
ExBPY |
prog1 |
Progression of first control point
|
ExBPY |
time2 |
Time of first control point
|
ExBPY |
prog2 |
Progression of first control point
|
ExBPY |
time |
0-1 lerp controller (automatically clamped)
|
Returns
CubicBezierLerp<T>(ExBPY, ExBPY, ExBPY, ExBPY, ExBPY, Func<TExArgCtx, TEx<T>>, Func<TExArgCtx, TEx<T>>)
Declaration
public static Func<TExArgCtx, TEx<T>> CubicBezierLerp<T>(ExBPY time1, ExBPY prog1, ExBPY time2, ExBPY prog2, ExBPY time, Func<TExArgCtx, TEx<T>> f1, Func<TExArgCtx, TEx<T>> f2)
Parameters
Type |
Name |
Description |
ExBPY |
time1 |
|
ExBPY |
prog1 |
|
ExBPY |
time2 |
|
ExBPY |
prog2 |
|
ExBPY |
time |
|
System.Func<TExArgCtx, TEx<T>> |
f1 |
|
System.Func<TExArgCtx, TEx<T>> |
f2 |
|
Returns
Type |
Description |
System.Func<TExArgCtx, TEx<T>> |
|
Type Parameters
Damp(tfloat, tfloat, tfloat)
Provide a soft ceiling for the value, multiplying any excess by the value RATIO.
Declaration
public static tfloat Damp(tfloat ceiling, tfloat ratio, tfloat value)
Parameters
Type |
Name |
Description |
tfloat |
ceiling |
|
tfloat |
ratio |
|
tfloat |
value |
|
Returns
Ease<T>(Func<TExArgCtx, TEx<Func<Single, Single>>>, Single, Func<TExArgCtx, TEx<T>>)
Apply a ease function on top of a target function that uses time as a controller.
Declaration
public static Func<TExArgCtx, TEx<T>> Ease<T>(Func<TExArgCtx, TEx<Func<float, float>>> smoother, float maxTime, Func<TExArgCtx, TEx<T>> f)
Parameters
Type |
Name |
Description |
System.Func<TExArgCtx, TEx<System.Func<System.Single, System.Single>>> |
smoother |
Smoothing function (ExMEasers)
|
System.Single |
maxTime |
Time over which to perform easing
|
System.Func<TExArgCtx, TEx<T>> |
f |
Target parametric (describing offset)
|
Returns
Type |
Description |
System.Func<TExArgCtx, TEx<T>> |
|
Type Parameters
EaseD<T>(String, Single, Func<TExArgCtx, TEx<T>>)
Apply a ease function on top of a target derivative function that uses time as a controller.
Primarily used for velocity parametrics.
Declaration
public static Func<TExArgCtx, TEx<T>> EaseD<T>(string smoother, float maxTime, Func<TExArgCtx, TEx<T>> f)
Parameters
Type |
Name |
Description |
System.String |
smoother |
Name of a float->float smoothing function (ExMEasers)
|
System.Single |
maxTime |
Time over which to perform easing
|
System.Func<TExArgCtx, TEx<T>> |
f |
Target parametric (describing velocity)
|
Returns
Type |
Description |
System.Func<TExArgCtx, TEx<T>> |
|
Type Parameters
EQuad0m10(tfloat, tfloat, tfloat)
Quadratic function that joins an ease-out and an ease-in, ie. two joined parabolas.
Declaration
public static tfloat EQuad0m10(tfloat midp, tfloat period, tfloat controller)
Parameters
Type |
Name |
Description |
tfloat |
midp |
|
tfloat |
period |
|
tfloat |
controller |
|
Returns
Lerp<T>(tfloat, tfloat, tfloat, TEx<T>, TEx<T>)
Lerp between two functions.
Note: Unless marked otherwise, all lerp functions clamp the controller.
Declaration
public static TEx<T> Lerp<T>(tfloat zeroBound, tfloat oneBound, tfloat controller, TEx<T> f1, TEx<T> f2)
Parameters
Type |
Name |
Description |
tfloat |
zeroBound |
Lower bound for lerp controller
|
tfloat |
oneBound |
Upper bound for lerp controller
|
tfloat |
controller |
Lerp controller
|
TEx<T> |
f1 |
First function (when controller leq zeroBound, return this)
|
TEx<T> |
f2 |
Second function (when controller geq oneBound, return this)
|
Returns
Type Parameters
Lerp01<T>(tfloat, TEx<T>, TEx<T>)
Lerp between two functions with 0-1 as the bounds for the controller.
Declaration
public static TEx<T> Lerp01<T>(tfloat controller, TEx<T> f1, TEx<T> f2)
Parameters
Type |
Name |
Description |
tfloat |
controller |
|
TEx<T> |
f1 |
|
TEx<T> |
f2 |
|
Returns
Type Parameters
Lerp01U<T>(tfloat, TEx<T>, TEx<T>)
Lerp between two functions with 0-1 as the bounds for the controller. The controller is not clamped.
Declaration
public static TEx<T> Lerp01U<T>(tfloat controller, TEx<T> f1, TEx<T> f2)
Parameters
Type |
Name |
Description |
tfloat |
controller |
|
TEx<T> |
f1 |
|
TEx<T> |
f2 |
|
Returns
Type Parameters
Lerp3<T>(tfloat, tfloat, tfloat, tfloat, tfloat, TEx<T>, TEx<T>, TEx<T>)
Lerp between three functions.
Between zeroBound and oneBound, lerp from the first to the second.
Between zeroBound2 and oneBound2, lerp from the second to the third.
Declaration
public static TEx<T> Lerp3<T>(tfloat zeroBound, tfloat oneBound, tfloat zeroBound2, tfloat oneBound2, tfloat controller, TEx<T> f1, TEx<T> f2, TEx<T> f3)
Parameters
Type |
Name |
Description |
tfloat |
zeroBound |
|
tfloat |
oneBound |
|
tfloat |
zeroBound2 |
|
tfloat |
oneBound2 |
|
tfloat |
controller |
|
TEx<T> |
f1 |
|
TEx<T> |
f2 |
|
TEx<T> |
f3 |
|
Returns
Type Parameters
Lerp3c<T>(tfloat, tfloat, tfloat, tfloat, TEx<T>, TEx<T>, TEx<T>)
Lerp between three functions.
Between zeroBound and oneBound, lerp from the first to the second.
Between oneBound and twoBound, lerp from the second to the third.
Declaration
public static TEx<T> Lerp3c<T>(tfloat zeroBound, tfloat oneBound, tfloat twoBound, tfloat controller, TEx<T> f1, TEx<T> f2, TEx<T> f3)
Parameters
Type |
Name |
Description |
tfloat |
zeroBound |
|
tfloat |
oneBound |
|
tfloat |
twoBound |
|
tfloat |
controller |
|
TEx<T> |
f1 |
|
TEx<T> |
f2 |
|
TEx<T> |
f3 |
|
Returns
Type Parameters
Lerp4<T>(tfloat, tfloat, tfloat, tfloat, tfloat, tfloat, tfloat, TEx<T>, TEx<T>, TEx<T>, TEx<T>)
Lerp between four functions.
Between zeroBound and oneBound, lerp from the first to the second.
Between zeroBound2 and oneBound2, lerp from the second to the third.
Between zeroBound3 and oneBound3, lerp from the third to the fourth.
Declaration
public static TEx<T> Lerp4<T>(tfloat zeroBound, tfloat oneBound, tfloat zeroBound2, tfloat oneBound2, tfloat zeroBound3, tfloat oneBound3, tfloat controller, TEx<T> f1, TEx<T> f2, TEx<T> f3, TEx<T> f4)
Parameters
Type |
Name |
Description |
tfloat |
zeroBound |
|
tfloat |
oneBound |
|
tfloat |
zeroBound2 |
|
tfloat |
oneBound2 |
|
tfloat |
zeroBound3 |
|
tfloat |
oneBound3 |
|
tfloat |
controller |
|
TEx<T> |
f1 |
|
TEx<T> |
f2 |
|
TEx<T> |
f3 |
|
TEx<T> |
f4 |
|
Returns
Type Parameters
LerpBack<T>(tfloat, tfloat, tfloat, tfloat, tfloat, TEx<T>, TEx<T>)
Lerp between two functions.
Between zeroBound and oneBound, lerp from the first to the second.
Between oneBound2 and zeroBound2, lerp from the second back to the first.
Declaration
public static TEx<T> LerpBack<T>(tfloat zeroBound, tfloat oneBound, tfloat oneBound2, tfloat zeroBound2, tfloat controller, TEx<T> f1, TEx<T> f2)
Parameters
Type |
Name |
Description |
tfloat |
zeroBound |
Lower bound for lerp controller
|
tfloat |
oneBound |
Upper bound for lerp controller
|
tfloat |
oneBound2 |
Upper bound for lerp controller
|
tfloat |
zeroBound2 |
Lower bound for lerp controller
|
tfloat |
controller |
Lerp controller
|
TEx<T> |
f1 |
First function (when controller leq zeroBound, return this)
|
TEx<T> |
f2 |
Second function (when controller geq oneBound, return this)
|
Returns
Type Parameters
LerpD<T>(TEx<T>, TEx<T>)
Lerp between a value for easy difficulty and lunatic difficulty.
Declaration
public static TEx<T> LerpD<T>(TEx<T> f1, TEx<T> f2)
Parameters
Type |
Name |
Description |
TEx<T> |
f1 |
|
TEx<T> |
f2 |
|
Returns
Type Parameters
LerpMany<T>((UncompiledCode<Single> bd, UncompiledCode<T> val)[], Func<TExArgCtx, TEx<Single>>)
Lerp between many functions.
Declaration
public static Func<TExArgCtx, TEx<T>> LerpMany<T>((UncompiledCode<float> bd, UncompiledCode<T> val)[] points, Func<TExArgCtx, TEx<float>> controller)
Parameters
Type |
Name |
Description |
System.ValueTuple<UncompiledCode<System.Single>, UncompiledCode<T>>[] |
points |
|
System.Func<TExArgCtx, TEx<System.Single>> |
controller |
|
Returns
Type |
Description |
System.Func<TExArgCtx, TEx<T>> |
|
Type Parameters
LerpR<T>(TEx<T>, TEx<T>)
Lerp between a value for minimum rank and maximum rank.
Declaration
public static TEx<T> LerpR<T>(TEx<T> f1, TEx<T> f2)
Parameters
Type |
Name |
Description |
TEx<T> |
f1 |
|
TEx<T> |
f2 |
|
Returns
Type Parameters
LerpSmooth<T>(TEx<Func<Single, Single>>, tfloat, tfloat, tfloat, TEx<T>, TEx<T>)
Lerp between two functions with smoothing applied to the controller.
Declaration
public static TEx<T> LerpSmooth<T>(TEx<Func<float, float>> smoother, tfloat zeroBound, tfloat oneBound, tfloat controller, TEx<T> f1, TEx<T> f2)
Parameters
Type |
Name |
Description |
TEx<System.Func<System.Single, System.Single>> |
smoother |
|
tfloat |
zeroBound |
|
tfloat |
oneBound |
|
tfloat |
controller |
|
TEx<T> |
f1 |
|
TEx<T> |
f2 |
|
Returns
Type Parameters
LerpT<T>(ExBPY, ExBPY, Func<TExArgCtx, TEx<T>>, Func<TExArgCtx, TEx<T>>)
Lerp between f1
and f2
using time (t
) as a controller.
Declaration
public static Func<TExArgCtx, TEx<T>> LerpT<T>(ExBPY zeroBound, ExBPY oneBound, Func<TExArgCtx, TEx<T>> f1, Func<TExArgCtx, TEx<T>> f2)
Parameters
Type |
Name |
Description |
ExBPY |
zeroBound |
Lower bound for time. When t=zeroBound, return f1.
|
ExBPY |
oneBound |
Upper bound for time. When t=oneBound, return f2.
|
System.Func<TExArgCtx, TEx<T>> |
f1 |
First lerp value
|
System.Func<TExArgCtx, TEx<T>> |
f2 |
Second lerp value
|
Returns
Type |
Description |
System.Func<TExArgCtx, TEx<T>> |
|
Type Parameters
LerpT3<T>(ExBPY, ExBPY, ExBPY, ExBPY, Func<TExArgCtx, TEx<T>>, Func<TExArgCtx, TEx<T>>, Func<TExArgCtx, TEx<T>>)
Declaration
public static Func<TExArgCtx, TEx<T>> LerpT3<T>(ExBPY zeroBound, ExBPY oneBound, ExBPY twoBound, ExBPY threeBound, Func<TExArgCtx, TEx<T>> f1, Func<TExArgCtx, TEx<T>> f2, Func<TExArgCtx, TEx<T>> f3)
Parameters
Type |
Name |
Description |
ExBPY |
zeroBound |
|
ExBPY |
oneBound |
|
ExBPY |
twoBound |
|
ExBPY |
threeBound |
|
System.Func<TExArgCtx, TEx<T>> |
f1 |
|
System.Func<TExArgCtx, TEx<T>> |
f2 |
|
System.Func<TExArgCtx, TEx<T>> |
f3 |
|
Returns
Type |
Description |
System.Func<TExArgCtx, TEx<T>> |
|
Type Parameters
LerpU<T>(tfloat, tfloat, tfloat, TEx<T>, TEx<T>)
Lerp between two functions. The controller is not clamped.
Declaration
public static TEx<T> LerpU<T>(tfloat zeroBound, tfloat oneBound, tfloat controller, TEx<T> f1, TEx<T> f2)
Parameters
Type |
Name |
Description |
tfloat |
zeroBound |
Lower bound for lerp controller
|
tfloat |
oneBound |
Upper bound for lerp controller
|
tfloat |
controller |
Lerp controller
|
TEx<T> |
f1 |
First function
|
TEx<T> |
f2 |
Second function
|
Returns
Type Parameters
Ratio(tfloat, tfloat, tfloat)
Get the value t such that LerpUnclamped(a, b, t) = x.
Do not use if a = b.
Declaration
public static tfloat Ratio(tfloat a, tfloat b, tfloat x)
Parameters
Type |
Name |
Description |
tfloat |
a |
Lower lerp bound
|
tfloat |
b |
Upper lerp bound
|
tfloat |
x |
Resulting lerp value
|
Returns
RotateLerp(tfloat, tfloat, tfloat, tv2, tv2)
Declaration
public static tv2 RotateLerp(tfloat zeroBound, tfloat oneBound, tfloat controller, tv2 source, tv2 target)
Parameters
Type |
Name |
Description |
tfloat |
zeroBound |
|
tfloat |
oneBound |
|
tfloat |
controller |
|
tv2 |
source |
|
tv2 |
target |
|
Returns
RotateLerpCCW(tfloat, tfloat, tfloat, tv2, tv2)
Declaration
public static tv2 RotateLerpCCW(tfloat zeroBound, tfloat oneBound, tfloat controller, tv2 source, tv2 target)
Parameters
Type |
Name |
Description |
tfloat |
zeroBound |
|
tfloat |
oneBound |
|
tfloat |
controller |
|
tv2 |
source |
|
tv2 |
target |
|
Returns
RotateLerpCW(tfloat, tfloat, tfloat, tv2, tv2)
Declaration
public static tv2 RotateLerpCW(tfloat zeroBound, tfloat oneBound, tfloat controller, tv2 source, tv2 target)
Parameters
Type |
Name |
Description |
tfloat |
zeroBound |
|
tfloat |
oneBound |
|
tfloat |
controller |
|
tv2 |
source |
|
tv2 |
target |
|
Returns
Select<T>(Func<TExArgCtx, TEx<Single>>, UncompiledCode<T>[])
Select one of an array of values. If OOB, selects the last element.
Note: this expands to (if i = 0) arr[0] (if i = 1) arr[1] ....
This may sound stupid, but since each value is a function, there's no way to actually store it in an array.
Declaration
public static Func<TExArgCtx, TEx<T>> Select<T>(Func<TExArgCtx, TEx<float>> index, UncompiledCode<T>[] points)
Parameters
Type |
Name |
Description |
System.Func<TExArgCtx, TEx<System.Single>> |
index |
|
UncompiledCode<T>[] |
points |
|
Returns
Type |
Description |
System.Func<TExArgCtx, TEx<T>> |
|
Type Parameters
SelectDC<T>(TEx<T>, TEx<T>, TEx<T>, TEx<T>)
Select a value according to the current difficulty counter.
Declaration
public static TEx<T> SelectDC<T>(TEx<T> easy, TEx<T> normal, TEx<T> hard, TEx<T> lunatic)
Parameters
Type |
Name |
Description |
TEx<T> |
easy |
|
TEx<T> |
normal |
|
TEx<T> |
hard |
|
TEx<T> |
lunatic |
|
Returns
Type Parameters
Smooth(TEx<Func<Single, Single>>, tfloat)
Apply a contortion to a 0-1 range.
This returns an approximately linear function.
Declaration
[Obsolete("Instead of running 'smooth(eiosine, t)', you may simply run 'eiosine(t)'.")]
public static tfloat Smooth(TEx<Func<float, float>> smoother, tfloat controller)
Parameters
Type |
Name |
Description |
TEx<System.Func<System.Single, System.Single>> |
smoother |
Smoothing function (ExMEasers)
|
tfloat |
controller |
0-1 value
|
Returns
SmoothC(TEx<Func<Single, Single>>, tfloat)
Apply a contortion to a clamped 0-1 range.
This returns an approximately linear function.
Declaration
public static tfloat SmoothC(TEx<Func<float, float>> smoother, tfloat controller)
Parameters
Type |
Name |
Description |
TEx<System.Func<System.Single, System.Single>> |
smoother |
Smoothing function (ExMEasers)
|
tfloat |
controller |
0-1 value (clamped if outside)
|
Returns
SmoothIO(TEx<Func<Single, Single>>, TEx<Func<Single, Single>>, tfloat, tfloat, tfloat, tfloat)
Apply a contortion to a 0-x range, returning:
0-1 in the range [0,s1]
1 in the range [s1,x-s2]
1-0 in the range [x-s2,x]
Declaration
public static tfloat SmoothIO(TEx<Func<float, float>> smoother1, TEx<Func<float, float>> smoother2, tfloat total, tfloat smth1, tfloat smth2, tfloat controller)
Parameters
Type |
Name |
Description |
TEx<System.Func<System.Single, System.Single>> |
smoother1 |
First Smoothing function (ExMEasers)
|
TEx<System.Func<System.Single, System.Single>> |
smoother2 |
Second Smoothing function (ExMEasers)
|
tfloat |
total |
Total time
|
tfloat |
smth1 |
Smooth-in time
|
tfloat |
smth2 |
Smooth-out time
|
tfloat |
controller |
0-x value
|
Returns
SmoothIOe(TEx<Func<Single, Single>>, tfloat, tfloat, tfloat)
Apply SmoothIO where name=name1=name2 and smth=smth1=smth2.
Declaration
public static tfloat SmoothIOe(TEx<Func<float, float>> smoother, tfloat total, tfloat smth, tfloat controller)
Parameters
Type |
Name |
Description |
TEx<System.Func<System.Single, System.Single>> |
smoother |
|
tfloat |
total |
|
tfloat |
smth |
|
tfloat |
controller |
|
Returns
SmoothLoop(TEx<Func<Single, Single>>, tfloat)
Get the value of an easer at a given point between 0 and 1.
The return value is periodized, so if the input is 5.4, then the output is 5 + ease(0.4).
Declaration
public static tfloat SmoothLoop(TEx<Func<float, float>> smoother, tfloat controller)
Parameters
Type |
Name |
Description |
TEx<System.Func<System.Single, System.Single>> |
smoother |
Smoothing function (ExMEasers)
|
tfloat |
controller |
|
Returns
SmoothLoopR(TEx<Func<Single, Single>>, tfloat, tfloat)
Returns R * SmoothLoop(name, controller/R).
Declaration
public static tfloat SmoothLoopR(TEx<Func<float, float>> smoother, tfloat range, tfloat controller)
Parameters
Type |
Name |
Description |
TEx<System.Func<System.Single, System.Single>> |
smoother |
|
tfloat |
range |
|
tfloat |
controller |
|
Returns
SmoothR(TEx<Func<Single, Single>>, tfloat, tfloat)
Apply a contortion to a 0-R range, returning R * Smooth(name, controller/R).
This returns an approximately linear function.
Declaration
public static tfloat SmoothR(TEx<Func<float, float>> smoother, tfloat range, tfloat controller)
Parameters
Type |
Name |
Description |
TEx<System.Func<System.Single, System.Single>> |
smoother |
Smoothing function (ExMEasers)
|
tfloat |
range |
Range
|
tfloat |
controller |
0-R value
|
Returns
SStep(tfloat, tfloat, tfloat)
Return 0 if the controller is leq the lower bound, 1 if the controller is geq the lower bound, and
a linear interpolation in between.
Declaration
public static tfloat SStep(tfloat zeroBound, tfloat oneBound, tfloat controller)
Parameters
Type |
Name |
Description |
tfloat |
zeroBound |
|
tfloat |
oneBound |
|
tfloat |
controller |
|
Returns
SwitchH<T>(ExBPY, ExBPY, Func<TExArgCtx, TEx<T>>, Func<TExArgCtx, TEx<T>>)
Return one of two functions depending on the input,
adjusting the switch variable by the reference switch amount if returning the latter function.
Declaration
public static Func<TExArgCtx, TEx<T>> SwitchH<T>(ExBPY switchVar, ExBPY at, Func<TExArgCtx, TEx<T>> f1, Func<TExArgCtx, TEx<T>> f2)
Parameters
Type |
Name |
Description |
ExBPY |
switchVar |
The variable upon which pivoting is performed. Should be either "p" (firing index) or "t" (time).
|
ExBPY |
at |
Reference
|
System.Func<TExArgCtx, TEx<T>> |
f1 |
Function when t \leq at
|
System.Func<TExArgCtx, TEx<T>> |
f2 |
Function when t \gt at
|
Returns
Type |
Description |
System.Func<TExArgCtx, TEx<T>> |
|
Type Parameters