我已经在canvas
. 但是我遇到了一个问题:
当线宽很小时(3),曲线看起来不错;
当线宽大(20)时,曲线由于断裂而看起来不好。
canvas.node.onmousemove = function (e) {
if (!canvas.isDrawing) {
return;
}
var x = e.pageX - this.offsetLeft;
var y = e.pageY - this.offsetTop;
ctx.beginPath();
ctx.moveTo(canvas.lastX, canvas.lastY);
ctx.strokeStyle = '#000000';
ctx.lineWidth = self.lineWidth();
ctx.lineTo(x, y);
ctx.stroke();
ctx.closePath();
canvas.lastX = x;
canvas.lastY = y;
};
canvas.node.onmousedown = function (e) {
canvas.isDrawing = true;
canvas.lastX = e.pageX - this.offsetLeft;
canvas.lastY = e.pageY - this.offsetTop;
};
canvas.node.onmouseup = function (e) {
canvas.isDrawing = false;
};
如何避免大线中断并使我的线稳固?
谢谢你。