Functions are the basic building blocks for Processing programs. They have appeared in every example we’ve presented. For instance, we’ve frequently used the
size() function, the
line() function, and the
fill() function. This chapter shows how to write new functions to extend the capabilities of Processing beyond its built-in features.
The power of functions is modularity. Functions are independent software units that are used to build more complex programs—like LEGO bricks, where each type of brick serves a specific purpose, and making a complex model requires using the different parts together. As with functions, the true power of these bricks is the ability to build many different forms from the same set of elements. ...