Begins adding vertices to a custom shape.
The beginShape() and endShape() functions allow for creating custom shapes in 2D or 3D. beginShape() begins adding vertices to a custom shape and endShape() stops adding them.
The parameter, kind, sets the kind of shape to make. By default, any irregular polygon can be drawn. The available modes for kind are:
POINTSto draw a series of points.LINESto draw a series of unconnected line segments.TRIANGLESto draw a series of separate triangles.TRIANGLE_FANto draw a series of connected triangles sharing the first vertex in a fan-like fashion.TRIANGLE_STRIPto draw a series of connected triangles in strip fashion.QUADSto draw a series of separate quadrilaterals (quads).QUAD_STRIPto draw quad strip using adjacent edges to form the next quad.TESSto create a filling curve by explicit tessellation (WebGL only).
After calling beginShape(), shapes can be built by calling vertex(), bezierVertex(), quadraticVertex(), and/or curveVertex(). Calling endShape() will stop adding vertices to the shape. Each shape will be outlined with the current stroke color and filled with the current fill color.
Transformations such as translate(), rotate(), and scale() don't work between beginShape() and endShape(). It's also not possible to use other shapes, such as ellipse() or rect(), between beginShape() and endShape().
Examples
Syntax
beginShape([kind])
Parameters
either POINTS, LINES, TRIANGLES, TRIANGLE_FAN TRIANGLE_STRIP, QUADS, QUAD_STRIP or TESS.