LINEを引こう

Canvasにラインを引いてみましょう

Sample03.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<title>Sample03.html</title>
<script>
function draw() {
	var canvas = document.getElementById("canvas1");
	var c = canvas.getContext("2d");
	c.lineWidth = 2;
	c.strokeStyle = "#999999";
	c.beginPath();
	c.moveTo(10,10);
	c.lineTo(100,120);
	c.closePath();
	c.stroke();
}
</script>
</head>
<body onload="draw()">
<canvas id="canvas1" width="300" height="300"></canvas>
</body>
</html>