5.2 Interaction in Processing

The Processing environment provides some extra functionality that makes it more convenient for us to build interactive systems. Previously, we’ve seen how Processing makes it easy for us to draw lines and shapes by merely using function calls to some ready-made functions. For interaction, the extra functionality is a little different. Instead of providing complete functions, Processing specifies a set of pre-determined function names that are related to making interactive programs. We still have to write the function definitions for these functions ourselves, using the def keyword that we learned in Chapter 3. But as long as we name these functions using a set of unique names, Processing will automatically use these functions for us in interesting ways. Let’s take a look at how this works.