Skip to content

format

typescript
Vector4.Lerp(lhs, rhs, t)

class: Vector4

description

Linearly interpolates between two vectors, lhs and rhs, based on a given interpolation parameter t, and returns the interpolated result.

parameter

param_nametypedescription
lhsVector4The starting vector.
rhsVector4The ending vector.
tnumberThe interpolation parameter, ranging from [0, 1]. When t is 0, lhs is returned. When t is 1, rhs is returned. The interpolation is calculated based on t for values in between.

return

typedescription
Vector4Returns a new Vector4 object representing the result of linear interpolation based on the interpolation parameter t.

code example

typescript
let lhs = new Vector4(1, 2, 3, 4);
let rhs = new Vector4(3, 4, 5, 6);
let lerp_v4 = Vector4.Lerp(lhs, rhs, 0.5);