Assignment 2

For Assignment 2 I was really focused on figuring out how to make things interact with your mouse by following it and by activating an additional shape via a mouse press. For this instance of the sketch I allowed for the colors to all be randomized but I have every intention of separating specific shapes into certain color groups in order to distinguish them in the future. I wanted to be able to draw with shapes with the mouse while also having the triangles along the top make their own line without any input, and I hope that eventually I can get this to a point where two “drawings” are happening at once in a much neater manner. I used the positions of these shapes to make them follow the cursor at mouseX, mouseY and I used a variable in order to make the triangles move. In addition, I need to figure out the issue of the rectangles continuing even while I have the mouse pressed, but all in all it is behaving very much how I expected it to,

 

int tri = 40;

void setup() {
background(0);
size(800, 600);
}

void draw() {
stroke(random(0,225), random(0,225), random(0,225));
strokeWeight(random(0,9));
fill(random(0,225), random(0,225), random(0,225));
rect(mouseX, mouseY, random(0,15), random(0,30));

tri = tri + 1;
triangle(tri, 80, 20 + tri, 60, 40+tri, 100);

if(mousePressed) {
stroke(random(0,225), random(0,225), random(0,225));
strokeWeight(random(0,9));
fill(random(0,225), random(0,225), random(0,225));
ellipse(mouseX,mouseY,random(10),random(10));
}
}