How to move the pen to a start position for drawing a line in JavaScript

1 Answer

0 votes
<canvas id="canvas" width="1024" height="600"></canvas>
<script type="text/JavaScript">   

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

ctx.beginPath();
ctx.strokeStyle = 'blue';
ctx.moveTo(50, 50);
ctx.lineTo(300, 50);
ctx.stroke();

</script>

 



answered May 27, 2016 by avibootz
...