Skip to content

Instantly share code, notes, and snippets.

@mimetaur
Created September 2, 2019 15:13
Show Gist options
  • Save mimetaur/cea2716dadcff6a9a545919faeafb138 to your computer and use it in GitHub Desktop.
Save mimetaur/cea2716dadcff6a9a545919faeafb138 to your computer and use it in GitHub Desktop.
Strokes example in p5 js
function setup() {
createCanvas(600, 600);
background(0);
}
function draw() {
background(0);
strokeWeight(9); // this sets a thick stroke width
// rectMode(CENTER);
rect(0, 300, width / 2, height / 2);
noStroke(); // this removes the stroke altogether
rect(300, 0, width / 2, height / 2);
stroke(0); // this sets a black stroke
// rect to create rectangle
rect(20, 30, 45, 250);
rect(90, 30, 45, 250);
rect(160, 30, 45, 250);
rect(230, 30, 45, 250);
// line diagonal
strokeWeight(1); // this makes a thinner weight line
line(0, 360, 60, 300);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment