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_name | type | description |
|---|---|---|
| lhs | Vector2 | The starting vector. |
| rhs | Vector2 | The ending vector. |
| t | number | The 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
| type | description |
|---|---|
Vector2 | Returns 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);