0211 - Interaction and Conditional Testing I: A mouse-sensitive square
In the code from the examples from last Wednesday, I provided an example of detecting whether the mouse was in a certain region of the screen ("Testing the location of the mouse on screen").
In a canvas which is exactly 300x300 pixels, create a simple "interactive square" in the center of the screen, whose size is 100x100 pixels. Create an interaction such that this square is filled RED when the mouse cursor is inside the square. The square should be black otherwise.
In coding your answer, ask yourself whether your code tests (A) whether the mouse is within the square, or (B) whether the mouse is not within the square.