p5.js Shape Complete Reference

The p5.js Shape used to draw different types of shapes in 2D and 3D models. All the functions are mentioned below.
| 2D Primitives | Description | 
|---|---|
| arc() | It is used to draw an arc. | 
| ellipse() | It is used to draw an ellipse. | 
| circle() | It is used to draw the circle on the screen. | 
| line() | It is used to draw a line. | 
| point() | It is used to draw the point in a given coordinate position. | 
| quad() | It is used to draw a quadrilateral. | 
| rect() | It is used to draw the rectangle on the screen. | 
| square() | It is used to draw the square on the screen. | 
| triangle() | It is used to draw a triangle in a plane. | 
| Attributes | Description | 
|---|---|
| ellipseMode() | It sets the location where the ellipses are drawn by changing the way. | 
| rectMode() | It changes the way in which the parameters given to the rect() function are interpreted. | 
| smooth() | It gets smooth Amplitude analysis by averaging with the last analysis frame by default it is off. | 
| strokeCap() | It is used to set the style of line endings. | 
| strokeJoin() | It sets the joint style which connect the line segments. | 
| strokeWeight() | It sets the width of the stroke used for lines, points and the border around shapes. | 
| Curves | Description | 
|---|---|
| bezier() | It is used to draw cubic Bezier curve on the screen. | 
| bezierDetail() | It sets the resolution at which Beziers display. | 
| bezierPoint() | It evaluates the coordinates of a bezier curve at the given point. | 
| curve() | It draws a curved line between two points given in the middle four parameters on the screen. | 
| curveDetail() | It sets the resolution at which the curve will display. | 
| curveTightness() | It modifies the quality of curves created using the curve() and curveVertex() functions. | 
| curvePoint() | It evaluates the coordinates of a curve at the given point. | 
| Vertex | Description | 
|---|---|
| beginContour() | It can be used to remove a portion of a shape with the given vertices. | 
| beginShape() | It is used to draw more complex shapes. | 
| bezierVertex() | It specifies the vertex coordinates used to draw a bezier curve. | 
| curveVertex() | It specifies the vertex coordinates used to draw a curve. | 
| endContour() | It stops the recording of vertices when creating a contour using the beginContour() function. | 
| endShape() | It is used after the beginShape() function to finish the drawing of a shape. | 
| quadraticVertex() | It specifies the vertex coordinates used to draw a quadratic bezier curve. | 
| vertex() | It specifies the coordinates of the vertices used to draw a shape. | 
| 3D Primitives | Description | 
|---|---|
| plane() | It is used to draw a plane according to the given height and width. | 
| box() | It draws a box with given height, width and the depth. | 
| sphere() | It is used to draw a sphere with given radius. | 
| cylinder() | It draws a cylinder with given radius and height. | 
| cone() | It draws a cone with given radius and height. | 
| ellipsoid() | It draws an ellipsoid with given radius. | 
| torus() | It draws a torus with given torus radius and tube radius. | 
| 3D Models | Description | 
|---|---|
| loadModel() | It is used to load a 3d model from file, and return it as a p5.Geometry Object. | 
| model() | It is used to render a 3D model to the screen. | 
 
				 
					


