MCPcopy
hub / github.com/processing/p5.js / lerp

Method lerp

src/math/p5.Vector.js:2423–2431  ·  view source on GitHub ↗

* @param {p5.Vector} v p5.Vector to lerp toward. * @param {Number} amt * @chainable

(x, y, z, amt)

Source from the content-addressed store, hash-verified

2421 * @chainable
2422 */
2423 lerp(x, y, z, amt) {
2424 if (x instanceof Vector) {
2425 return this.lerp(x.x, x.y, x.z, y);
2426 }
2427 this.x += (x - this.x) * amt || 0;
2428 this.y += (y - this.y) * amt || 0;
2429 this.z += (z - this.z) * amt || 0;
2430 return this;
2431 }
2432
2433 /**
2434 * Calculates a new heading and magnitude that are between two vectors.

Callers

nothing calls this directly

Calls 3

_friendlyErrorMethod · 0.95
copyMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected