Conclusion

There are many ways to organize your canvas-related drawing code. What we looked at here are just two approaches that broadly describe how to think about this problem. For simple drawings, all of this is overkill. That’s why we didn’t do anything like this in many articles prior to this where we looked at each drawing method by itself. Now, as you start to create more complex designs or add animation (as we will see shortly), this fast-and-carefree way will end up hurting you in the long run. At that point, you’ll be glad to use something like the functions-only or the functions/object approach we looked at in this article.

Get hands-on with 1200+ tech skills courses.