Structuring your Drawing Code

Up until this point, we've been drawing each shape individually. That was fine for learning how the various draw commands work. In real life, you'll rarely issue draw commands directly. You'll instead delegate the drawing to a helper function or custom object or something else that makes drawing things more maintainable.

For example, take a look at the following, work of art:

widget

What you see is a bunch of randomly overlaid semi-transparent circles. That's not the most interesting thing we are going to be focusing on. The interesting thing is looking at how this example was implemented. We bring these circles to life using two approaches that help make your canvas drawings easier to re-use and maintain, and we'll learn all about how to do that here.

Onwards!