Line Drawing – now with FUNCTIONS

So I’ve been working on my line drawing sketch, now it’s organized via functions.

 


float rndm;

void setup() {
rndm = random(255);

size (500,500);
background(255);
smooth();
frameRate(30);

}

void draw() {

lineparameters();
clicks();

}

void lineparameters() {

fill(0);
line(250,250,mouseX,mouseY);

}

void clicks() {
if(keyPressed && (key==CODED)) {
if(keyCode == SHIFT) {
background(255);

}
}
}

void mousePressed() {

stroke(0);
fill(0);
line(mouseX,mouseY,0,0);
line(mouseX,mouseY,500,500);
line(mouseX,mouseY,0,500);
line(mouseX,mouseY,500,0);

}

Leave a Reply

Your email address will not be published. Required fields are marked *