開発環境 |
メモ帳 |
実行環境 |
Internet Explorer 11 |
canvas2.html
<!doctype html>
<head>
<meta charset="UTF-8">
<title>canvas2</title>
<script>
function test() {
var width = canvas1.width;
var height = canvas1.height;
var ctx = canvas1.getContext("2d");
var centerx = width / 2;
var centery = height / 2;
ctx.beginPath();
ctx.moveTo(centerx, 0);
ctx.lineTo(centerx, height);
ctx.moveTo(0, centery);
ctx.lineTo(width, centery);
ctx.closePath();
ctx.lineWidth = 1;
ctx.strokeStyle = "rgba(255, 255, 255, 1.0)";
ctx.stroke();
}
</script>
</head>
<body onload="test();">
<canvas id="canvas1" width=640 height=480 style="background-color:CornflowerBlue;"></canvas>
</body>
最終更新:2015年05月19日 20:20