Project 3.2: Pixels
Create a program that draws randomly colored boxes at different scales
Create a program that draws a grid of randomly colored rectangles on the screen each time the user clicks the mouse.
The window must be sized exactly 512 x 512
Your program must start with boxes that are sized 32 x 32
Each time the user left clicks, the size is halved and new boxes are drawn
Each time the user right clicks, the size is doubled and new boxes are drawn
There is a minimum size of 1 and a maximum size of 512.
FAQ / Tips
Step by Step
What colors can I use?
As long as the colors have some randomness, feel free to change the palette. For example, it might be "shades of blue" or "fall colors."
My mousePressed() isn't doing anything!
Explanation: mousePressed() only works in programs with a draw method
Solution: Add a draw method (even if it's empty)
EXAMPLE: RUNNING PROGRAM
Examples with Alternate Colors