Skip to content

Instantly share code, notes, and snippets.

Created June 21, 2011 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1037688 to your computer and use it in GitHub Desktop.
Save anonymous/1037688 to your computer and use it in GitHub Desktop.
Light points
// sw and sh are width and height of canvas
// lightpoints are like this: lightpoints[i] = [x, y]
// the grid is 32 pixels
// How do I make them not intersect?
gc.save();
gc.globalAlpha = 0.25;
gc.fillStyle = "black";
gc.shadowColor = "black";
gc.shadowBlur = 5;
gc.beginPath();
gc.rect(0, 0, sw, sh);
for(i=0; i < lightpoints.length; i+=1) {
gc.arc(lightpoints[i][0]+16, lightpoints[i][1]+16, 96, Math.PI*2, 0, true);
}
gc.closePath();
gc.fill();
gc.restore();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment