Open In App

p5.js noStroke() Function

Last Updated : 11 Aug, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The noStroke() function is an inbuilt function in p5.js which is used to remove the outline which is used to draw lines and borders around shapes. By default, black color stroke is set to shapes.

Syntax:

noStroke()

Parameters: This function does not accepts any parameter.

Below program illustrates the noStroke() function in P5.js:
Program:




function setup() {
  
    // Canvas size 400*400
    createCanvas(400, 400); 
}
  
function draw() {
  
    // Shape defined just below, will not have any outline
    noStroke(); 
  
    // Fill light-green color to shape
    fill('lightgreen'); 
    rect(20, 20, 160, 160);
}


Output:

Reference: https://p5js.org/reference/#/p5/noStroke


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads