Skip to content

Instantly share code, notes, and snippets.

@RANUX
Last active September 3, 2018 21:13
Show Gist options
  • Save RANUX/6aead80cf269a95601ef04e391ae6ae1 to your computer and use it in GitHub Desktop.
Save RANUX/6aead80cf269a95601ef04e391ae6ae1 to your computer and use it in GitHub Desktop.
Draw squares grid with p5.js and Sketch
var canvasWidth = 1200;
var canvasHeight = 1024;
function setup() {
createCanvas(canvasWidth, canvasHeight);
}
function draw() {
stroke("#DCA6A6");
strokeWeight(0.1);
beginShape();
var width = canvasWidth/8;
var height = canvasHeight/8;
for(var i=0; i <= height; i++) {
vertex(0, i*8);
vertex(canvasWidth, i*8);
vertex(0, i*8);
}
for(var i=0; i <= width; i++) {
vertex(i*8, 0);
vertex(i*8, canvasHeight);
vertex(i*8, 0);
}
endShape();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment