Transformations alter a given point’s starting position by moving, rotating & scaling that point.

You can also do less common transformations, like shearing (skewing), by directly setting the transformation matrix of the canvas using context.transform.

Translate (==move) a point with context.translate(75,25)

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/262dff3b-f66f-4f51-b1af-b4e4d587bbf3/Untitled.png

Rotate a point with context.rotate(Math.PI/8)

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/e333d897-3f65-46ad-b669-1ad31d81bc1c/Untitled.png

Scale a point with context.scale(2,2)

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/cf78d15a-61d1-4b3d-bb21-a83cf408bd8b/Untitled.png

Canvas actually achieves transformations by altering the canvas’ entire coordinate system.

Canvas transformations are persistent. All New drawings will continue to be transformed until you reset the canvas’ transformation back to it’s default state (==totally untransformed). You can reset back to default with:

// reset context transformations to the default (untransformed) state
context.setTransform(1,0,0,1,0,0);