Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Color gradient example using lerpColor
var color1, color2;
var gradientHeight = 300; //change this to change how far down the screen the gradient goes
function setup() {
createCanvas(800, 800);
color1 = color('#e67e22');
color2 = color('#2ecc71');
var lineNum = 0;
while (lineNum < gradientHeight) {
stroke(lerpColor(color1, color2, 1 / gradientHeight * lineNum));
line(0, lineNum, width, lineNum);
lineNum += 1;
}
}
function draw() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.