Skip to content

format

typescript
Vector2.Lerp(lhs, rhs, t)

class: Vector2

description

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

parameter

param_nametypedescription
lhsVector2The starting vector.
rhsVector2The ending vector.
tnumberThe interpolation parameter, ranging from 0 to 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
Vector2Returns a new Vector2 object representing the result of linear interpolation based on the interpolation parameter t.

code example

typescript
let lhs = new Vector2(1, 2);
let rhs = new Vector2(3, 4);
let lerp_v2 = Vector2.Lerp(lhs, rhs, 0.5);