Using Buttons To Trigger JavaScripts: Animate Canvas Objects With Transforms

Below is a canvas element with an id of canvasElement

The following buttons demonstrate javascripts to to a transform and rotate function, but using save() and restore() instead of Processing's pushMatrix() and popMatrix() to a square inside the Canvas element. The Round and Square canvas do a little logic to change the border-radius CSS properties of the Canvas element itself.