This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.
color from = color(204, 102, 0);
color to = color(0, 102, 153);
color interA = lerpColor(from, to, .33);
color interB = lerpColor(from, to, .66);
rect(10, 20, 20, 60);
rect(30, 20, 20, 60);
rect(50, 20, 20, 60);
rect(70, 20, 20, 60);
Calculates a color or colors between two color at a specific increment. The amt parameter is the amount to interpolate between the two values where 0.0 equal to the first point, 0.1 is very near the first point, 0.5 is halfway in between, etc.
lerpColor(c1, c2, amt)
||int: interpolate from this color
||int: interpolate to this color
||float: between 0.0 and 1.0
Updated on May 10, 2013 06:12:08pm EDT