Reference+
Name
getChild()
Class
PShape
Description
Extracts a child shape from a parent shape. Specify the name of the shape with the target parameter. The shape is returned as a PShape object, or null is returned if there is an error.
Examples
PShape prefecture; PShape aichi; void setup() { size(400, 400); prefecture = loadShape("prefecture.svg"); aichi = prefecture.getChild("AICHI"); // id="AICHI" on svg file } void draw() { aichi.disableStyle(); background(255); fill(255); shape(prefecture, 0, 5); fill(94, 138, 248); // change the color shape(aichi, -10, -10); // move the location a bit }
Syntax
sh.getChild(index)
sh.getChild(target)
Parameters
sh
(PShape)
any variable of type PShapeindex
(int)
the layer position of the shape to gettarget
(String)
the name of the shape to get
Return
PShape
Related
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.