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() {
createCanvas(100, 100, WEBGL);
}
function draw() {
background(200);
plane(50, 50);
}
|
Output:
Reference: https://p5js.org/reference/#/p5/plane
Last Updated :
11 Aug, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...