How To Set Line Thickness in HTML5 Canvas

On January 14, 2010, in Web Coding, by admin

Today I was searching around the web trying to figure out how to set the line thickness in HTML5 Canvas.

I stumbled across this great cheatsheet:

http://www.nihilogic.dk/labs/canvas_sheet/HTML5_Canvas_Cheat_Sheet.png

It had the information I needed, after setting the context you do something like this to make the lines thicker:

1
drawingContext.lineWidth=4;

Then go ahead and do your stroke:

1
drawingContext.stroke();

The line should now be more thick.

Be Sociable, Share!
Tagged with:  

One Response to How To Set Line Thickness in HTML5 Canvas

  1. tim says:

    Thanks Travis! Helpful chart.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>