Name
endContour()
Class
PShape
Description
The beginContour() and endContour() methods make
 it possible to define shapes with other shapes cut out of them.
 For example, the inside of a letter 'O'. These two functions are
 always used together, you'll never use one without the other.
 Between them, define the geometry you want to create. As you'll
 see when you run the example above, the second smaller shape is
 cut out of the first larger shape.
 
 The exterior shape and the interior contour must wind
 in opposite directions. This means that if the points of the
 geometry for the exterior shape are described in a clockwise order,
 the points on the interior shape are defined in a counterclockwise order.
Examples
- PShape s; void setup() { size(200, 200, P2D); // Make a shape s = createShape(); s.beginShape(); //s.noStroke(); // Exterior part of shape s.vertex(-50,-50); s.vertex(50,-50); s.vertex(50,50); s.vertex(-50,50); // Interior part of shape s.beginContour(); s.vertex(-20,-20); s.vertex(-20,20); s.vertex(20,20); s.vertex(20,-20); s.endContour(); // Finish off shape s.endShape(CLOSE); } void draw() { background(204); translate(width/2, height/2); s.rotate(0.01); shape(s); }
Syntax
- sh.endContour()
Parameters
- sh- (PShape)any variable of type PShape
Return
- void
Related

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.