Skip to content

Instantly share code, notes, and snippets.

@yoshuawuyts
Created June 16, 2013 20:37
Show Gist options
  • Save yoshuawuyts/5793336 to your computer and use it in GitHub Desktop.
Save yoshuawuyts/5793336 to your computer and use it in GitHub Desktop.
/start code
int mX, mY; //global variable initialization
void setup() { //note sure about making the screen scalable, but if you can
size(640, 480); //the code for drawing the triangles is parametric, so it would work
background(200);
noStroke(); //outlines are bad
}
void draw() {
mX = mouseX; //sets mX to cursor's X position
mY = mouseY; //sets mY to cursor's Y position
fill(155, 111, 111, 111);
triangle(0, height, mouseX, mouseY, width/2, height); //draws red triangle
fill(105, 185, 185, 111);
triangle(width/2, height, mouseX, mouseY, width, height); //draws blue triangle
}
//endcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment