Google News
logo
p5.js - Interview Questions
What is the stroke() Function in p5.js?
The stroke() function sets the stroke color used for a shape to the specified color. It must be called before drawing the shape. The default stroke color is black.
 
function draw(){
  // Sets stroke color of the square to green
  stroke(0, 255, 0);
  square(50, 50, 25);
}
Advertisement