Custom line stroke in HTML5 canvas

When drawing strings with an HTML5 canvas element, is it possible to determine the stroke style of lines? Basically in Photoshop and other similar programs, you can define a stroke style for lines that look like they are "drawn." Is it possible to do something like this in HTML5 canvas or am I shooting for the moon here?

thank

-Jesse

+3
source share
2 answers

It is possible, but not by default. See the ShadowCloud post for what you can do by default (very little).

Depending on what you want, this should not be too complicated.

"" , , / .

, / drawImage .

, , .

, , .

+2

HTML5 Canvas API HTML5 Canvas.

, :

context.strokeStyle = '#f00'; // red color
context.lineWidth   = 4; // 4px wide

// Draw some rectangles.
context.fillRect  (0,   0, 100, 100);
context.strokeRect(0,   0, 100, 100);

You can try to get more control with the library ( Processing.js or Fabric.js )

+1
source

All Articles