Processing question
in
Programming Questions
•
6 months ago
THis is the first assignment we got this year. Can u help me out?
Now write a program that divides the screen canvas into four rectangles on the screen. The point where the four rectangles coincide should follow the mouse, therefore resizing the rectangles as the mouse is moved. When the user clicks any mouse button, each rectangle should change to a different random colour. You will need to investigate the use of the
random()
function to achieve this.
void setup() {
size(500, 500);
}
size(500, 500);
}
void draw() {
background(200);
rect(0, 0, mouseX, mouseY);
rect(mouseX, mouseY, 500, 500);
background(200);
rect(0, 0, mouseX, mouseY);
rect(mouseX, mouseY, 500, 500);
}
This is the best I can do now.........
1