Name

PVector_lerp

Description Calculates linear interpolation from one vector to another vector. (Just like regular lerp(), but for vectors.)

Note that there is one static version of this method, and two non-static versions. The static version, lerp(v1, v2, amt) is given the two vectors to interpolate and returns a new PVector object. The static version is used by referencing the PVector class directly. (See the middle example above.) The non-static versions, lerp(v, amt) and lerp(x, y, z, amt), do not return a new PVector, but transform the values of the PVector on which they are called. These non-static versions function the same way, but the former takes another vector as input, while the latter takes three float values. (See the top and bottom examples above, respectively.)
Syntax
.lerp(v, amt)
.lerp(v1, v2, amt)
.lerp(x, y, z, amt)
Parameters
vPVector: the vector to lerp to
amtfloat: The amount of interpolation; some value between 0.0 (old vector) and 1.0 (new vector). 0.1 is very near the new vector. 0.5 is halfway in between.
v1PVector: the vector to start from
v2PVector: the vector to lerp to
xfloat: the x component to lerp to
yfloat: the y component to lerp to
zfloat: the z component to lerp to
Related PVector_lerp
Creative Commons License