Skip to content

Instantly share code, notes, and snippets.

@claytical
Created September 7, 2015 15:10
Show Gist options
  • Save claytical/a4e8d60f670ceef5323a to your computer and use it in GitHub Desktop.
Save claytical/a4e8d60f670ceef5323a to your computer and use it in GitHub Desktop.
lerpColor example
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