Further, you could shave off a couple of bytes by inserting
<body onload=F()>
before the canvas element, instead of having <script>F()</script>
after the canvas element