Begin a path, move to position 20, 20. Create two lines - Javascript Canvas Reference

Javascript examples for Canvas Reference:lineTo

Description

Begin a path, move to position 20, 20. Create two lines

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<canvas id="myCanvas" width="300" height="250" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>

<script>

var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();/*  w  ww .  ja  v  a  2 s . co m*/
ctx.moveTo(20, 20);
ctx.lineTo(20, 100);
ctx.lineTo(70, 100);
ctx.stroke();

</script>

</body>
</html>

Related Tutorials