This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.
Class | PShape |
Name |
endContour() |
Examples |
PShape s;
void setup() {
size(100, 100, 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();
}
void draw() {
background(52);
translate(width/2, height/2);
s.rotate(0.01);
shape(s);
}
|
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.
|
Syntax | sh.endContour() |
Parameters |
sh |
PShape: any variable of type PShape |
|
Returns | void |
Related | beginContour()
|
Updated on May 19, 2014 05:30:03pm PDT