Skip to content

Instantly share code, notes, and snippets.

@zeroeth
Created July 24, 2013 14:43
Show Gist options
  • Select an option

  • Save zeroeth/6071238 to your computer and use it in GitHub Desktop.

Select an option

Save zeroeth/6071238 to your computer and use it in GitHub Desktop.
color fading
color colorOne = color(255, 0, 0);
color colorTwo = color(0, 255, 255);
void setup() {
size(600, 600);
}
void draw() {
// give us a number between 0.0 and 1.0
float sineWave = sin(frameCount/50.0) * 0.5 + 0.5;
// use that number to select between two colors
color currentColor = lerpColor(colorOne, colorTwo, sineWave);
fill(currentColor);
rect(20, 20, 560, 560);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment