harry
unread,Jul 24, 2008, 8:52:02 AM7/24/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-excanvas
<html>
<head>
<!-- saved from url=(0014)about:internet -->
<script type="text/javascript" src="excanvas.js"></script>
</head>
<body onload="initCanvas()">
<p>Use the Ctrl+MouseWheel to zoom in & out. </p>
<p>In IE 7, the lines will cross :(</p>
<canvas id="c" onclick="drawLine(event.clientX,event.clientY,0,0)">
</canvas>
<script language="Javascript">
var d
var canvas
var ctx
var count;
function initCanvas() {
canvas = document.getElementById("c");
ctx = canvas.getContext("2d")
ctx.lineWidth = "2";
ctx.strokeStyle = "black";
ctx.beginPath();
count=0
// draw two lines from the same point.
drawLine(100, 50, 50, 150)
}
function drawLine(x1, y1, x2, y2) {
if(count==0)
{
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
//ctx.fill();
}
if(count>0)
{
ctx.lineTo(25, 35);
ctx.fill();
}
ctx.stroke();
count++;
}
</script>
</html>