Replaced var silhouetteColour with context.fillStyle;
Replaced function drawLine with context.fillRect;
Changed basic sanity check if (!s) to be if (s);
Removed allLineLengths array;
canvas.width is now window.innerWidth/2 (you can change it to be equal to
window.innerWidth. That should be enough.);