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:

filter_none

edit
close

play_arrow

link
brightness_4
code

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);
}                    

chevron_right


Output:

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



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : ManasChhabra2



Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.