So I have a bunch of javascript to make some random points, and then connects them via a minimum spanning tree. That all works fine.
Then after that it draws the points and paths onto the canvas; and it draws an image like this:
- Randomly generated each time.
The problem I have with this, is that I'd like to have each of the circles be a black circle with a yellow outline. The circles are drawn like so:
context.fillStyle = "#ffff00";
for(var i = 0; i < syscount; i++){
context.moveTo(systemsX[i],systemsY[i]);
context.arc(systemsX[i],systemsY[i],4,0,Math.PI*2,true);
}
context.fill();
and that works fine, but I want to draw a black circle, and have a yellow trace. I want to do it this way because it's much easier than stopping the lines that join the dots stop a few pixels earlier than they normally would.
This was my attempt:
context.fillStyle = "#000000";
for(var i = 0; i < syscount; i++){
context.moveTo(systemsX[i],systemsY[i]);
context.arc(systemsX[i],systemsY[i],ssize,0,Math.PI*2,true);
}
context.fill();
context.strokeStyle = "#ffff00";
for(var i = 0; i < syscount; i++){
context.moveTo(systemsX[i]+ssize,systemsY[i]);
context.arc(systemsX[i],systemsY[i],ssize,0,Math.PI*2,true);
}
context.stroke();
but it draws this:
?!! It redraws over the other path. Why?!
Zip of the page: http://rapidshare.com/files/415710231/page.zip (html file and a css file inside the zip). The snippet of code for drawing the circles starts at line 164.