Class EasingFunctionExtensions
- Namespace
- Stride.CommunityToolkit.Mathematics
- Assembly
- Stride.CommunityToolkit.dll
The fluent face of Easing: evaluate or interpolate straight from an
EasingFunction value, so a curve held in a field or a setting reads as
curve.Interpolate(from, to, t).
public static class EasingFunctionExtensions
- Inheritance
-
EasingFunctionExtensions
Remarks
Every method forwards to Ease<T>(T, EasingFunction) or to the matching MathUtilEx overload, so the time is clamped to [0, 1] the same way there.
Methods
Ease<T>(EasingFunction, T)
Evaluates the curve at a normalised time, clamped to [0, 1].
public static T Ease<T>(this EasingFunction function, T amount) where T : IFloatingPointIeee754<T>
Parameters
functionEasingFunctionThe curve.
amountTThe normalised time.
Returns
- T
The eased progress.
Type Parameters
TA floating-point type.
Interpolate(EasingFunction, Color, Color, float)
Interpolates between two colours along the curve, channel by channel.
public static Color Interpolate(this EasingFunction function, Color start, Color end, float amount)
Parameters
functionEasingFunctionThe curve.
startColorThe colour at time 0.
endColorThe colour at time 1.
amountfloatThe normalised time, clamped to [0, 1].
Returns
- Color
The interpolated colour.
Interpolate(EasingFunction, Vector2, Vector2, float)
Interpolates between two points along the curve.
public static Vector2 Interpolate(this EasingFunction function, Vector2 start, Vector2 end, float amount)
Parameters
functionEasingFunctionThe curve.
startVector2The point at time 0.
endVector2The point at time 1.
amountfloatThe normalised time, clamped to [0, 1].
Returns
- Vector2
The interpolated point.
Interpolate(EasingFunction, Vector3, Vector3, float)
Interpolates between two points along the curve.
public static Vector3 Interpolate(this EasingFunction function, Vector3 start, Vector3 end, float amount)
Parameters
functionEasingFunctionThe curve.
startVector3The point at time 0.
endVector3The point at time 1.
amountfloatThe normalised time, clamped to [0, 1].
Returns
- Vector3
The interpolated point.
Interpolate(EasingFunction, Vector4, Vector4, float)
Interpolates between two vectors along the curve.
public static Vector4 Interpolate(this EasingFunction function, Vector4 start, Vector4 end, float amount)
Parameters
functionEasingFunctionThe curve.
startVector4The vector at time 0.
endVector4The vector at time 1.
amountfloatThe normalised time, clamped to [0, 1].
Returns
- Vector4
The interpolated vector.
Interpolate(EasingFunction, float, float, float)
Interpolates between two values along the curve.
public static float Interpolate(this EasingFunction function, float start, float end, float amount)
Parameters
functionEasingFunctionThe curve.
startfloatThe value at time 0.
endfloatThe value at time 1.
amountfloatThe normalised time, clamped to [0, 1].
Returns
- float
The interpolated value.