Assignment 2: Colorful Illusion

This week I used for loops to create a popular illusion. Looking at the sketch you can see that some of the white circles start seeming as if they are black while all of them are white. This is a common illustration of optical illusion called lateral inhibition. Since the whole illusion can be done in the setup function, I wanted to add some complexity. When clicking on the screen, the circles randomly change their color. A bit of a playful element I guess.

The code that I’m proud of is the way I connected all the variables to the offset variable. By changing offset you can get either more of smaller circles with similar size of lines or less of bigger circles with bigger lines. Also, the user can change the window size and the sketch will still make perfect sense.

I’m proud of the fact that creating the illusion only took me 2 loops with singles lines.In the future,  I would like to make the interaction less random. As in making the circles change color one by one in a timely manner. Also, include the user interaction with keys and mouse movements.