Thursday, September 4, 2025
HomeLanguagesJavascriptp5.js plane() function

p5.js plane() function

The plane() function in p5.js is used to draw a plane according to the given height and width.

Syntax:

plane( width, height, detailX, detailY )

Parameters: The function accepts four parameters as mentioned above and described below:

  • width: This parameter holds the width of the plane to drawn.
  • height: This parameter holds the height of the plane to drawn.
  • detailX: It is an optional parameter that takes number of triangle subdivisions in x-dimension.
  • detailY: It is an optional parameter that takes number of triangle subdivisions in y-dimension.

Below program illustrates the plane() function in p5.js:

Example:




function setup() {
      
    // Create canvas size
    createCanvas(100, 100, WEBGL);
}
  
// Function to draw plane
function draw() {
    background(200);
      
    // Plane with width 50 
    // and height 50
    plane(50, 50);
}                    


Output:

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

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6629 POSTS0 COMMENTS
Nicole Veronica
11799 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11858 POSTS0 COMMENTS
Shaida Kate Naidoo
6749 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6698 POSTS0 COMMENTS
Umr Jansen
6716 POSTS0 COMMENTS