Calculates new x
, y
, and z
components that are proportionally the same distance between two vectors.
The amt
parameter is the amount to interpolate between the old vector and the new vector. 0.0 keeps all components equal to the old vector's, 0.5 is halfway between, and 1.0 sets all components equal to the new vector's.
The static version of lerp()
, as in p5.Vector.lerp(v0, v1, 0.5)
, returns a new p5.Vector object and doesn't change the original.
Examples
Syntax
lerp(x, y, z, amt)
lerp(v, amt)
lerp()
lerp(v1, v2, amt, [target])
Parameters
Returns
Related References
textToContours
Returns an array of arrays of points outlining a string of text written using the font.
textToModel
Converts text into a 3D model that can be rendered in WebGL mode.
textToPaths
Returns a flat array of path commands that describe the outlines of a string of text.
textToPoints
Returns an array of points outlining a string of text written using the font.