Interactive Lines

On click the colors invert and you make a line from the center to wherever the mouse is clicked/dragged.

void setup() {

size(800, 600);
}

void draw() {
line(600, 0, 500, 600);
line(600, 0, 600, 600);
line(700, 0, 0, 700);
line(800, 100, 0, 250);
line(800, 100, 0, 350);
line(0, 200, 500, 600);
line(0, 400, 400, 450);
line(400, 450, 250, 230);
line(250, 230, 0, 230);
line(250, 230, 400, 300);
line(700, 200, 400, 300);
line(700, 200, 650, 50);
line(700, 200, 675, 600);
line(700, 200, 550, 120);
line(550, 120, 575, 600);
line(800, 120, 710, 150);
line(710, 150, 800, 220);
line(750, 181, 780, 600);
line(75, 0, 200, 180);
line(200, 180, 450, 0);
line(200, 180, 430, 100);
line(430, 100, 450, 0);
line(430, 100, 75, 0);
line(200, 180, 0, 0);

if (mousePressed==true) {
background(0,0,0);
stroke(250,250,250);
line(600, 0, 500, 600);
line(600, 0, 600, 600);
line(700, 0, 0, 700);
line(800, 100, 0, 250);
line(800, 100, 0, 350);
line(0, 200, 500, 600);
line(0, 400, 400, 450);
line(400, 450, 250, 230);
line(250, 230, 0, 230);
line(250, 230, 400, 300);
line(700, 200, 400, 300);
line(700, 200, 650, 50);
line(700, 200, 675, 600);
line(700, 200, 550, 120);
line(550, 120, 575, 600);
line(800, 120, 710, 150);
line(710, 150, 800, 220);
line(750, 181, 780, 600);
line(75, 0, 200, 180);
line(200, 180, 450, 0);
line(200, 180, 430, 100);
line(430, 100, 450, 0);
line(430, 100, 75, 0);
line(200, 180, 0, 0);
} else{background(250,250,250);
stroke(0,0,0);
line(600, 0, 500, 600);
line(600, 0, 600, 600);
line(700, 0, 0, 700);
line(800, 100, 0, 250);
line(800, 100, 0, 350);
line(0, 200, 500, 600);
line(0, 400, 400, 450);
line(400, 450, 250, 230);
line(250, 230, 0, 230);
line(250, 230, 400, 300);
line(700, 200, 400, 300);
line(700, 200, 650, 50);
line(700, 200, 675, 600);
line(700, 200, 550, 120);
line(550, 120, 575, 600);
line(800, 120, 710, 150);
line(710, 150, 800, 220);
line(750, 181, 780, 600);
line(75, 0, 200, 180);
line(200, 180, 450, 0);
line(200, 180, 430, 100);
line(430, 100, 450, 0);
line(430, 100, 75, 0);
line(200, 180, 0, 0);
}

if(mousePressed==true) {
line(mouseX, mouseY, 400, 300);
}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s