David Babayan
David Babayan

Reputation: 49

canvas.lineCap and canvas.closePath not work together

This is my code:

canvas.lineCap = "round";
canvas.lineWidth = 15;
canvas.beginPath();
canvas.moveTo(100, 100);
canvas.lineTo(200, 100);
canvas.closePath();

If I delete canvas.closePath() then canvas.lineCap works otherwise that parameter not work. So what is the problem?

Upvotes: 0

Views: 1066

Answers (1)

Call

canvas.stroke();

Instead of

canvas.closePath();

canvas.closePath() would mean you want to draw a polygon, which I assume is not the case.

Upvotes: 1

Related Questions