Created
September 7, 2015 15:10
-
-
Save claytical/a4e8d60f670ceef5323a to your computer and use it in GitHub Desktop.
lerpColor example
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 startColor; | |
var endColor; | |
var bgColor; | |
var counter; | |
function setup() { | |
// uncomment this line to make the canvas the full size of the window | |
createCanvas(windowWidth, windowHeight); | |
startColor = color(255,0,0); | |
endColor = color(127,30,200); | |
counter = 0; | |
bgColor = lerpColor(startColor, endColor, counter); | |
} | |
function draw() { | |
// draw stuff here | |
background(bgColor); | |
counter = counter + .01; | |
bgColor = lerpColor(startColor, endColor, counter); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment