Created
February 10, 2017 18:54
-
-
Save nataliefreed/fac624fbaf2f305d992ea68c52f3a5ca to your computer and use it in GitHub Desktop.
Color gradient example using lerpColor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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