We were inspired by the sketch Tickle (Examples > Topics > Interaction > Tickle), which shows a word that you can “tickle” by moving your mouse over it. We decided to expand on this theme and incorporate more “action” words into our sketch.
Our sketch starts with an instruction screen. The user clicks the mouse to enter the interactive environment.
Initially, all the words are stationary. By pressing the first letter of each word, the word starts to move in a fashion appropriate to its meaning. If the user presses “L”, the word “loop” loops across the space. Similarly, pressing “S” causes the word “shake” to shake (similar to “tickle” in the example sketch), “F” for “follow” (the word follows the cursor), and “P” for “pause” (all action is paused). Pressing each letter again stops the action (or, in the case of “pause”, causes the action to start again). Each of these actions are controlled by different boolean variables. When the specified key is pressed, the status of the boolean variable is changed and the action is started or stopped.
The last elements are the changing colors of the word “chameleon” and the background. “chameleon” flashes different random colors every 23 times the draw function is called, unless the sketch is in a “pause” state; the background changes colors with every mouse click. Once the background and “chameleon” colors match exactly, the screen shows “We have a winner!!” and the sketch is no longer interactive. The “chameleon” is set to match the background every 1000 times the draw method is called. The user can reload the sketch to play again.