Braveheart
New Member
- Joined
- Mar 26, 2008
- Messages
- 1,115 (0.19/day)
System Name | mystie |
---|---|
Processor | intel Q9450 |
Motherboard | gigabyte EP45 UD3P |
Cooling | coolit domino ALC |
Memory | 4GB DDR3 1333 |
Video Card(s) | sapphire 4870x2 |
Storage | 250GB barracuda, 1.5TB barracuda |
Display(s) | 15" phillips, HannsG HD 28" |
Case | custom built plexiglass cube |
Audio Device(s) | Creative audigy SE |
Power Supply | Silverstone Strider 700W |
Software | Vista home premium 64/ Ubuntu 10.04 Beta 64 |
HTML:
<!DOCTYPE HTML>
<html>
<body>
<canvas id="canvas" width="200" height="100;">
Your browser does not support the canvas element.
</canvas>
<script type="text/javascript">
//get reference to the canvas
var c=document.getElementById("canvas");
var cxt=c.getContext("2d");
//draw circle
cxt.fillStyle="#FF0000";
cxt.beginPath();
cxt.arc(75,75,10,0,Math.PI*2,true);
cxt.closePath();
cxt.fill();
//animate circle
var x = 150;
var y = 150;
var dx = 2;
var dy = 4;
var ctx;
function init() {
ctx = $('#canvas')[0].getContext("2d");
return setInterval(draw, 10);
}
function draw() {
ctx.clearRect(0,0,300,300);
ctx.beginPath();
ctx.arc(x, y, 10, 0, Math.PI*2, true);
ctx.closePath();
ctx.fill();
x += dx;
y += dy;
}
init();
</script>
</body>
</html>
anyone know what I'm doing wrong that would cause the red ball to not move?
Last edited: