Last active
September 5, 2018 05:16
-
-
Save kellylougheed/3987cd506c828e89a7acd6685135dbf7 to your computer and use it in GitHub Desktop.
This file contains 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 hue; | |
var rainbow = true; | |
var rate = 1; | |
function setup() { | |
createCanvas(windowWidth, windowHeight); | |
background(0); | |
hue = 0; | |
} | |
function draw() { | |
// background(220); | |
} | |
function mouseDragged() { | |
if (rainbow) { | |
if (hue > 360) { | |
hue = 0; | |
} else { | |
hue += rate; | |
} | |
} | |
colorMode(HSL, 360); | |
noStroke(); | |
fill(hue, 200, 200); | |
ellipse(mouseX, mouseY, 25, 25); | |
} | |
function keyPressed() { | |
if (keyCode == 82) { | |
hue = 0; | |
rainbow = false; | |
} | |
if (keyCode == 71) { | |
hue = 125; | |
rainbow = false; | |
} | |
if (keyCode == 66) { | |
hue = 200; | |
rainbow = false; | |
} | |
if (keyCode == 32) { | |
rainbow = true; | |
rate *= 2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment