Name

lerpColor()

Examples
stroke(255)
background(51)
fromC = color(204, 102, 0)
toC = color(0, 102, 153)
interA = lerpColor(fromC, toC, .33)
interB = lerpColor(fromC, toC, .66)
fill(fromC)
rect(10, 20, 20, 60)
fill(interA)
rect(30, 20, 20, 60)
fill(interB)
rect(50, 20, 20, 60)
fill(toC)
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 halfway in between, etc.
An amount below 0 will be treated as 0. Likewise, amounts above 1 will be capped at 1. This is different from the behavior of lerp(), but necessary because otherwise numbers outside the range will produce strange and unexpected colors.
Syntax
lerpColor(c1, c2, amt)
Parameters
c1int: interpolate from this color
c2int: interpolate to this color
amtfloat: between 0.0 and 1.0
Related color()
lerp()

Updated on Mon Sep 21 15:53:25 2020.

If you see any errors or have comments, please let us know.