Learn creative coding writing simple programs

96. Easier mouse in a rectangle

Using rectMode(CENTER) makes it harder to find out if the mouse is inside a square. If we use rectMode(CORNERS) the program becomes much simpler because we don't need to calculate the position of the four walls of our rectangle: we already know them.
In this episode we also see a small example of how we can generate colors that have the same hue but a different brightness or saturation.

Tags: rect, inside, mouse, point

Code editor

You can make changes to the code below. Then
Questions and comments are welcome! :) But please try to stay close to the topic of this episode. Use the Processing forums for help with your Processing projects (or hire me for help ;-)