This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.
| Class | PShape |
| Name |
addChild() |
| Examples |
PShape group;
void setup() {
// Make a group PShape
group = createShape(GROUP);
// Make three shapes
PShape path = createShape();
path.beginShape();
path.vertex(-20, -20);
path.vertex(0, -40);
path.vertex(20, -20);
path.endShape();
PShape rectangle = createShape(RECT, -20, -20, 40, 40);
PShape circle = createShape(ELLIPSE, 0, 0, 20, 20);
// Add all three as children
group.addChild(path);
group.addChild(rectangle);
group.addChild(circle);
}
void draw() {
background(52);
translate(mouseX, mouseY);
shape(group);
}
|
| Description |
This is a new reference entry for Processing 2.0. It will be updated shortly. For now, please check the Examples to see how to use this new syntax.
|
| Syntax | sh.addChild(who)
sh.addChild(who, idx) |
| Parameters |
| sh |
PShape: any variable of type PShape |
| who |
PShape: any variable of type PShape |
| idx |
int: the layer position in which to insert the new child |
|
| Returns | void |
| Related | getChild()
|
Updated on April 30, 2017 02:33:19pm EDT