Skip to content

Commit

Permalink
Made the runningbrushes pictures tileable
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJan00 committed Mar 10, 2012
1 parent 7d57c97 commit 173f6e9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions runningbrushes/runningbrushes.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,34 @@ var RunningBrushes = function() {

self.draw = function(agent) {
self.ctxt.fillStyle = "rgba("+agent.red+","+agent.green+","+agent.blue+","+agent.alpha+")";

// normal circle
self.ctxt.beginPath();
self.ctxt.arc(agent.x, agent.y, agent.radius, 0, Math.PI*2, true);
self.ctxt.fill();

// off-limits
if (agent.x + agent.radius > self.canvas.width) {
self.ctxt.beginPath();
self.ctxt.arc(agent.x - self.canvas.width, agent.y, agent.radius, 0, Math.PI*2, true);
self.ctxt.fill();
}
if (agent.x - agent.radius < 0) {
self.ctxt.beginPath();
self.ctxt.arc(agent.x + self.canvas.width, agent.y, agent.radius, 0, Math.PI*2, true);
self.ctxt.fill();
}
if (agent.y + agent.radius > self.canvas.height) {
self.ctxt.beginPath();
self.ctxt.arc(agent.x, agent.y - self.canvas.height, agent.radius, 0, Math.PI*2, true);
self.ctxt.fill();
}
if (agent.y - agent.radius < 0) {
self.ctxt.beginPath();
self.ctxt.arc(agent.x, agent.y + self.canvas.height, agent.radius, 0, Math.PI*2, true);
self.ctxt.fill();
}

}
}

Expand Down

0 comments on commit 173f6e9

Please sign in to comment.