lerpColor() \ Language (API) \ Processing 1.0
Author: Casey Reas & Ben Fry
Description: Processing is an electronic sketchbook for developing ideas. It is a context for learning fundamentals of computer programming within the context of the electronic arts.
Keywords: Processing, Processing, Interactive Media, Electronic Arts, Programming, Java, Ben Fry, Casey Reas

Reference for Processing version 1.5. 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.

Name | ### lerpColor()
Examples |
    stroke(255);
    background(51);
    color from = color(204, 102, 0);
    color to = color(0, 102, 153);
    color interA = lerpColor(from, to, .33);
    color interB = lerpColor(from, to, .66);
    fill(from);
    rect(10, 20, 20, 60);
    fill(interA);
    rect(30, 20, 20, 60);
    fill(interB);
    rect(50, 20, 20, 60);
    fill(to);
    rect(70, 20, 20, 60);
Description | 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 half-way in between, etc.
Syntax |
    lerpColor(c1, c2, amt)
Parameters |
c1 | color: interpolate from this color
c2 | color: interpolate to this color
amt | float: between 0.0 and 1.0
Returns | float
Usage | Web & Application
Related | blendColor() color()

Updated on August 30, 2010 04:29:39pm EDT