Simply download the .zxp from http://drawscri.pt/ and use the Adobe Extension Manager to add and enable it for Adobe Illustrator, and you are away.
Draw a shape, and hey presto, you get the output automatically created.
<canvas id="drawscript" width="750" height="750"></canvas>
var canvas = document.getElementById('drawscript'); var ctx = canvas.getContext('2d');
// generated code goes here
See the following live page for an example output:
(there is no error handling or fallback code – if don’t see anything, your browser may not support HTML5 canvas, or I’ve probably made a mistake – but it worked for me in Chrome, FF, Safari…)
The comments on this blog are 99.9% spam so I rarely check them – but I regularly check twitter: @bseymour