How To

Mirror Engine API / math / lerpAngle
Function: lerpAngle()
function lerpAngle(a: number, b: number, alpha: number): number
Calculates the linear interpolation of two angles ensuring that interpolation is correctly performed across the 360 to 0 degree boundary. Angles are supplied in degrees.
Parameters
a
number
Angle (in degrees) to linearly interpolate from.
b
number
Angle (in degrees) to linearly interpolate to.
alpha
number
The value controlling the result of interpolation. When alpha is 0, a is returned. When alpha is 1, b is returned. Between 0 and 1, a linear interpolation between a and b is returned. alpha is clamped between 0 and 1.
Returns
number
The linear interpolation of two angles.