Advertisement
Guest User

Untitled

a guest
May 26th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. function drawGrid() {
  2. var w = gridCanvas.width;
  3. var h = gridCanvas.height;
  4.  
  5. gridContext.clearRect(0, 0, w, h);
  6.  
  7. gridContext.beginPath();
  8. gridContext.strokeStyle = "#999999";
  9. gridContext.lineWidth = 0.3;
  10.  
  11. var x = distanceBetweenLines;
  12. while(x <= w) {
  13. gridContext.moveTo(x, 0);
  14. gridContext.lineTo(x, h);
  15. x += distanceBetweenLines;
  16. }
  17.  
  18. var y = distanceBetweenLines;
  19. while(y <= h) {
  20. gridContext.moveTo(0, y);
  21. gridContext.lineTo(w, y);
  22. y += distanceBetweenLines;
  23. }
  24.  
  25. gridContext.stroke();
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement