The Wayback Machine - https://web.archive.org/web/20211121101201/https://www.geeksforgeeks.org/p5-js-nofill-function/
Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

p5.js | noFill() Function

  • Last Updated : 25 Jul, 2019

The noFill() function is used to disable the filling geometry. If noStroke() and noFill() function are called simultaneously then nothing will be drawn on the screen.

Syntax:

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

noFill()

Parameters: This function does not accept any parameter.

Below examples illustrate the noFill() function in p5.js:



Example 1:




function setup() { 
      
    // Create Canvas of given size 
    createCanvas(400, 300); 
} 
  
function draw() { 
      
    // Set the background color 
    background(220); 
      
    // Use fill() function to fill color
    fill('green')
    // Draw a line 
    rect(50, 50, 150, 150); 
      
    // Use noFill() function
    noFill();
    
    // Draw a line 
    rect(100, 100, 150, 150); 
} 

Output:

Example 2:




function setup() { 
      
    // Create Canvas of given size 
    createCanvas(400, 300); 
} 
  
function draw() { 
      
    // Set the background color 
    background(220); 
      
    // Use noFill() function
    noFill();
      
    // Draw a line 
    circle(140, 100, 150);
      
    // Use fill() function to fill color
    fill('green')
    // Draw a line 
    circle(240, 100, 150); 
} 

Output:

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




My Personal Notes arrow_drop_up
Recommended Articles
Page :