Skip to content

Instantly share code, notes, and snippets.

@mathisonian
Created May 9, 2014 15:21
Show Gist options
  • Save mathisonian/9cf4b95b6d1c163f49d5 to your computer and use it in GitHub Desktop.
Save mathisonian/9cf4b95b6d1c163f49d5 to your computer and use it in GitHub Desktop.
cosmic latte gradients
void setup() {
size(640, 360);
colorMode(HSB, 360, 1, 1);
background(0);
}
void draw() {
clear();
for (int i=0; i<width; i++) {
color currentLatte = color(42, 0.094, 1);
for (int j=0; j<height; j++) {
float targetSat = .407;
float satVar = 0.3;
// vary on some saturation to make pretty colors
// color currentBlue = color(212, map(j, 0, height, targetSat - satVar, targetSat + satVar), 0.992);
// stroke(lerpColor(currentLatte, currentBlue, 0.5));
// or vary on the lerp param to make real gradients
color currentBlue = color(212, targetSat, 0.992);
stroke(lerpColor(currentLatte, currentBlue, map(j, 0, height, 0, 1)));
point(i, j);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment