The most difficult thing about learning how to transform the canvas is how bizarre it is. If you are familiar with transforms in CSS, you know that you only affect the element or elements you are targeting. In the wacky world of the canvas, there is no concept of an element. Everything is either the canvas itself or raw pixels. If you wish to draw something rotated (or scaled or translated), you transform the canvas first and then draw whatever you were planning on drawing. The strangeness of this all goes away with practice…and a lot of therapy.

Get hands-on with 1200+ tech skills courses.