The simplest ay to test above code is to create a Canvas Element in your HTML fie and set its Id Attribute to "portalcanvas". And Paste above code in a script tag, that's all. You can also see my previous code about basics of canvas Canvas Part 1
You're showing how to use canvas as svg (kind of) - i doubt people will actually make complex graphics with writing code. You'll probably get some tool to export (kind of) vector graphics from graphics programs to your style of drawing.
That makes me wonder - will they make some html elements representing lines, boxes, arcs, etc to nest inside canvas element? Would save alot of coding time..