2-1-4.

ϴ Ӽ ִ. lineWidth Ӽ ⸦ ϴµ Ʈ 1ȼ̴. Ӽ ϸ ܰ β.

 

linewidth.html

function draw() {

     ctx.strokeRect(10,10,90,90);

     ctx.lineWidth=5;

     ctx.strokeRect(110,10,90, 90);

     ctx.lineWidth=10;

     ctx.strokeRect(210,10,90, 90);

}

 

ٲ 簢 ׷ȴ. ƹ Ʈ ׷ 5 10 ٲٸ ׸ŭ ȹ . ȹ ʰ ٱ ݾ Ȯȴ.

Ǿ ִ. lineCap Ӽ ϴµ butt, round, square ϳ Ѵ. 20ȼ ٲ㰡 ׸.

 

linecap.html

function draw() {

     ctx.lineWidth=20;

     ctx.lineCap="butt";

     ctx.beginPath();

     ctx.moveTo(20, 20);ctx.lineTo(200, 20);

     ctx.stroke();

    

     ctx.lineCap="round";

     ctx.beginPath();

     ctx.moveTo(20, 70);ctx.lineTo(200, 70);

     ctx.stroke();

    

     ctx.lineCap="square";

     ctx.beginPath();

     ctx.moveTo(20, 120);ctx.lineTo(200, 120);

     ctx.stroke();

}

 

butt ǥ ׾ round square ǥ Ȯȴ.

lineJoin Ѵ. 簢ó 𼭸 ִ. bevel, round, miter ϳ ϸ Ʈ miter̴.

 

linejoin.html

function draw() {

     ctx.lineWidth=20;

     ctx.lineJoin="bevel";

     ctx.strokeRect(20,20,60,60);

     ctx.lineJoin="round";

     ctx.strokeRect(120,20,60,60);

     ctx.lineJoin="miter";

     ctx.strokeRect(220,20,60,60);

}

 

20ȼ β Ͽ 𼭸 и ֵ ߴ. bevel 𼭸 κ 񽺵 ߶ ̸ round ձ۰ óѴ.

miter miterLimit Ӽ Ѱ谪 Ͽ ʹ ʵ Ѵ. ¿ ʹ ָ ִµ Ѱ踦 ν ϴ Ѵ.