Mirror Engine
V5
How To
Mirror Engine Logo

Mirror Engine API


Mirror Engine API / math / lerp

Function: lerp()

function lerp(a: number, b: number, alpha: number): number

Calculates the linear interpolation of two numbers.

Parameters

a

number

Number to linearly interpolate from.

b

number

Number 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 numbers.

Mirror Engine Logo