The endContour() function in p5.js is used to stop the recording of vertices when creating a countour using the beginContour() function. These functions are used to remove a portion of a shape from another shape.
The vertices of the interior shape have to be defined in the opposite direction to that of the exterior one. If the exterior shape has the vertices defined in the clockwise order, then the interior shape has to be defined in the counter-clockwise direction. The recording of the interior shape is then stopped by using this function.
This function can only be used inside the beginShape() or endShape() function. Transformations like translate(), rotate() and scale() do not work with shapes and contours.
Parameters: This function accepts no parameters.
The program below illustrates the endContour() function in p5.js:
Online editor: https://editor.p5js.org/
Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/