MathHelper.Lerp Method (Microsoft.Xna.Framework)
Linearly interpolates between two values.
- C#
- VB
- F#
public static float Lerp( float value1, float value2, float amount )
Syntax for VB is not yet implemented.
Syntax for F# is not yet implemented.
Parameters
- value1
-
Type: System.Single
Source value.
- value2
-
Type: System.Single
Destination value.
- amount
-
Type: System.Single
Value between 0 and 1 indicating the weight of value2.
Return Value
Type: System.SingleInterpolated value.
This method performs the linear interpolation based on the following formula:
value1 + (value2 - value1) * amount
.
Passing amount a value of 0 will cause value1 to be returned, a value of 1 will cause value2 to be returned.
See LerpPrecise(float, float, float) for a less efficient version with more precision around edge cases.
Supported in:
Windows DirectX Desktop
Linux Desktop
Windows OpenGL Desktop
Web
Windows DirectX Desktop
Linux Desktop
Windows OpenGL Desktop
Web