HTML5画笔笔尖
问题描述:
答
您只需绘制一条路径到您的画布并将lineCap
设置为round
。
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
context.beginPath();
context.moveTo(10, 10);
context.lineTo(canvas.width/2, canvas.height/2);
context.lineWidth = 10;
context.strokeStyle = "red";
context.lineCap = "round";
context.stroke();