Skip to content

Instantly share code, notes, and snippets.

@crongro
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crongro/8821369 to your computer and use it in GitHub Desktop.
Save crongro/8821369 to your computer and use it in GitHub Desktop.
A Pen by younjisu.
<canvas id="canvas" width="150" height="150"></canvas>
//orignal code
//https://developer.mozilla.org/samples/canvas-tutorial/4_5_canvas_linewidth.html
(function(){
var ctx = document.getElementById('canvas').getContext('2d');
for (var i=0; i<10; i++){
var iStrokeWidth = 1 + i;
var iTranslate = (iStrokeWidth % 2) / 2;
ctx.translate(iTranslate, 0);
ctx.lineWidth = iStrokeWidth;
ctx.beginPath();
ctx.moveTo(5+i*14, 5);
ctx.lineTo(5+i*14, 140);
ctx.stroke();
ctx.translate(-iTranslate, 0);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment