Code
boolean click;
void setup () {
size (400, 400);
background (60);
click = false;
}
void loop ( ) {
if (click == true) {
fill (0);
} else {
if ((mousePressed == true)
&& (mouseX >= 150)
&& (mouseX <= 250)
&& (mouseY >= 150)
&& (mouseY <= 250)) {
click = true;
} else {
fill (255);
}
}
rect (150, 150, 100, 100);
}
001 -- Conditional Testing in Interactivity: Using IF
Statement:All of the assignments for this week will require applets that are 400x400 pixels, with a 100x100 pixel square centered in the middle.
For each assignment, be sure to upload a 100x100 pixel icon for your project. Test to make sure your work has uploaded properly!
On a grey background, place a square of 100x100 pixels. Create an interaction such that, if the user clicks in the square, it turns black, and stays that way.
...yeah