fromColor = color(196,4,129) toColor = color(4, 196, 159) size(600,600) background(255) i = 0 while i <= 6: j = 0 while j <= 6: # Solution 1: a color gradient using a looping variable # fill( i*40, 0, j*40 ) # Solution 2: a color gradient using lerpColor() # interA = lerpColor(fromColor, toColor, i*j/36.0) # Solution 2b: a variation on the above, using lerpColor() to # make a gradient fading in the other direction # interA = lerpColor(fromColor, toColor, 1-i*j/36.0) fill(interA) rect(j*100,i*100, 100,100) j = j + 1 i = i + 1 # trying to make a gradient using lerpColor() but # can only make the first two rows change