How to draw a line on the canvas with round line cap in JavaScript

1 Answer

0 votes
<canvas id="canvas"></canvas>
<script type="text/JavaScript">   

var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");

ctx.beginPath();
ctx.moveTo(10, 10);
ctx.lineWidth = 17;
ctx.lineCap = "round";
ctx.lineTo(120, 120);
ctx.stroke();

/*
run:  
    
   
*/
  
</script>

 



answered May 24, 2016 by avibootz
...