Created
July 25, 2011 11:55
-
-
Save mahemoff/1103972 to your computer and use it in GitHub Desktop.
canvas draw grid (jquery + kaffeine)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.grid = (interval) -> { | |
var canvas = @[0], context = canvas.getContext('2d') | |
x = y = 0.5 | |
while((x+=interval)<canvas.width) { | |
context.moveTo(x,0) | |
context.lineTo(x,canvas.height) | |
} | |
while((y+=interval)<canvas.height) { | |
context.moveTo(0,y) | |
context.lineTo(canvas.width,y) | |
} | |
context.strokeStyle = "rgba(0,0,0,0.5)" | |
context.stroke(); | |
} | |
// $("canvas").grid(16) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment