Reference endContour()


Stops creating a hole within a flat shape.

The beginContour() and endContour() functions allow for creating negative space within custom shapes that are flat. beginContour() begins adding vertices to a negative space and endContour() stops adding them. beginContour() and endContour() must be called between beginShape() and endShape().

Transformations such as translate(), rotate(), and scale() don't work between beginContour() and endContour(). It's also not possible to use other shapes, such as ellipse() or rect(), between beginContour() and endContour().

Note: The vertices that define a negative space must "wind" in the opposite direction from the outer shape. First, draw vertices for the outer shape clockwise order. Then, draw vertices for the negative space in counter-clockwise order.


Related References