lerp()
Math / CalculationDescription
Calculates a number between two numbers at a specific increment. amt 0.0 returns a, amt 1.0 returns b.
Syntax
float lerp(float a, float b, float t)
Parameters
| Name | Type | Description |
|---|---|---|
| a | float | first value |
| b | float | second value |
| t | float | between 0.0 and 1.0 |
Returns
floatRelated
Under the Hood
From Processing.h:
PVector& lerp(const PVector& v, float t) { x+=(v.x-x)*t; y+=(v.y-y)*t; z+=(v.z-z)*t; return *this; }
PVector& lerp(float _x, float _y, float _z, float t) { x+=(_x-x)*t; y+=(_y-y)*t; z+=(_z-z)*t; return *this; }
static PVector lerp(const PVector& a, const PVector& b, float t) {
return PVector(a.x+(b.x-a.x)*t, a.y+(b.y-a.y)*t, a.z+(b.z-a.z)*t);
}
static PColor lerp(const PColor& c1, const PColor& c2, float t) {
return PColor(c1.r+(c2.r-c1.r)*t, c1.g+(c2.g-c1.g)*t, c1.b+(c2.b-c1.b)*t, c1.a+(c2.a-c1.a)*t);
}
float lerp(float,float,float);
inline float lerp(A a,B b2,C t){ return _api::lerp((float)a,(float)b2,(float)t);
static float lerp(float a, float b, float t) { return a+t*(b-a); }
inline float lerp(float a,float b,float t){ return PApplet::lerp(a,b,t); }
inline float lerp(float a,float b,float t){ return PApplet::lerp(a,b,t);