Skip to content

Instantly share code, notes, and snippets.

@kellylougheed
Created September 5, 2018 05:12
Show Gist options
  • Save kellylougheed/5d2434a35238ddbdf3f8c5e8b55277a9 to your computer and use it in GitHub Desktop.
Save kellylougheed/5d2434a35238ddbdf3f8c5e8b55277a9 to your computer and use it in GitHub Desktop.
var hue;
var rainbow = true;
function setup() {
createCanvas(windowWidth, windowHeight);
background(0);
hue = 0;
}
function draw() {
// background(220);
}
function mouseDragged() {
if (rainbow) {
if (hue > 360) {
hue = 0;
} else {
hue++;
}
}
colorMode(HSL, 360);
noStroke();
fill(hue, 200, 200);
ellipse(mouseX, mouseY, 25, 25);
}
function keyPressed() {
if (keyCode == 82) {
hue = 0;
rainbow = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment