Canvas lineCap() 方法

观看不同值的演示 lineCap() 方法.

或者点击指定值查看结果

lineCap('butt');
lineCap('round');
lineCap('square');
your browser does not support the canvas tag
your browser does not support the canvas tag
your browser does not support the canvas tag
let c = document.getElementById('myCanvas');
let ctx = c.getContext('2d');
ctx.lineWidth=10;  
ctx.lineCap='butt';    
ctx.moveTo(20,20);
ctx.lineTo(200,200);
ctx.stroke();

在编辑器中更多地使用代码: 亲自尝试一下 ❯