Skip to content

Instantly share code, notes, and snippets.

Created June 15, 2013 18:29
Show Gist options
  • Save anonymous/5789069 to your computer and use it in GitHub Desktop.
Save anonymous/5789069 to your computer and use it in GitHub Desktop.
float colorRangeX;
float colorRangeY;
void setup() {
// where we set things up
size(450, 600);
background(0);
smooth();
noStroke();
}
void draw() {
// where we draw. this loops forever...
// clear the screen
//background(0);
colorRangeX = map(mouseX, 0, width, 0, 255);
colorRangeY = map(mouseY, 0, height, 255, 0);
//println("mouse x:" + mouseX);
//println("x:" + colorRangeX);
//println("y:" + colorRangeY);
noStroke();
fill(colorRangeX, 0, colorRangeY, 10);
// draw circles on the corners
ellipse(0, 0, 100, 100);
ellipse(width, 0, 100, 100);
ellipse(width, height, 100, 100);
ellipse(0, height, 100, 100);
// draw a circle in the center
ellipse(width/2, height/2, mouseX, mouseY);
ellipse(mouseX, mouseY, 50, 50);
ellipse(width-mouseX, mouseY, 50, 50);
ellipse(mouseX, height-mouseY, 50, 50);
ellipse(width-mouseX, height-mouseY, 50, 50);
stroke(0, 30);
line(0, 0, mouseX, mouseY);
line(width, 0, mouseX, mouseY);
line(width, height, mouseX, mouseY);
line(0, height, mouseX, mouseY);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment