hangman.addChild(createShape(LINE,20,100,20,30)); hangman.addChild(createShape(LINE,20,30,50,30)); hangman.addChild(createShape(LINE,50,30,50,35)); hangmanMembers = new PShape[]{createShape(ELLIPSE,50,35,10,10),//head createShape(LINE ,55,45,55,50),//neck int livesDiff = maxLives-lives;//work out the number of lives lost (maximum value - current) if(livesDiff < maxLives) {//if there still is a shape to display hangman.addChild(hangmanMembers[livesDiff]);
static protected void copyGroup(PApplet parent, PShape src, PShape dest) { copyMatrix(src, dest); copyStyles(src, dest); copyImage(src, dest); for (int i = 0; i < src.childCount; i++) { PShape c = PShape.createShape(parent, src.children[i]); dest.addChild(c); } }
static protected void copyGroup(PApplet parent, PShape src, PShape dest) { copyMatrix(src, dest); copyStyles(src, dest); copyImage(src, dest); for (int i = 0; i < src.childCount; i++) { PShape c = PShape.createShape(parent, src.children[i]); dest.addChild(c); } }
static public void copyGroup(PGraphicsOpenGL pg, PShape src, PShape dest) { copyMatrix(src, dest); copyStyles(src, dest); copyImage(src, dest); for (int i = 0; i < src.getChildCount(); i++) { PShape c = createShape(pg, src.getChild(i)); dest.addChild(c); } }
static public void copyGroup(PGraphicsOpenGL pg, PShape src, PShape dest) { copyMatrix(src, dest); copyStyles(src, dest); copyImage(src, dest); for (int i = 0; i < src.getChildCount(); i++) { PShape c = createShape(pg, src.getChild(i)); dest.addChild(c); } }
Table data; PShape dataPlot; size(1620, 1080, P2D); //create a group to store the lines from each row dataPlot = createShape(GROUP); //load the data, specifying it has a header and it's tab separated data = loadTable("data.tsv", "header, tsv"); //traverse each row for (TableRow row : data.rows ()) { //extract each value int x1 = row.getInt("x1"); int y1 = row.getInt("y1"); int x2 = row.getInt("x2"); int y2 = row.getInt("y2"); //add the coordinates as lines to the group PShape line = createShape(LINE, x1, y1, x2, y2); float dist = dist(x1, y1, x2, y2); line.setStroke(color(map(dist, 0, height, 160, 0))); line.setStrokeWeight(map(dist, 0, height, 10.0, 1.0)); dataPlot.addChild(line); } //render the plot shape(dataPlot);
line.setStroke(color(map(dist, 0, height, 160, 0))); line.setStrokeWeight(map(dist, 0, height, 10.0, 1.0)); plot.addChild(line);
plot.addChild(line);
line.setStroke(color(map(dist, 0, height, 160, 0))); line.setStrokeWeight(map(dist, 0, height, 10.0, 1.0)); plot.addChild(line);
PShapeOpenGL c3d = (PShapeOpenGL)who; super.addChild(c3d); c3d.updateRoot(root); markForTessellation();
PShapeOpenGL c3d = (PShapeOpenGL)who; super.addChild(c3d, idx); c3d.updateRoot(root); markForTessellation();
PShapeOpenGL c3d = (PShapeOpenGL)who; super.addChild(c3d, idx); c3d.updateRoot(root); markForTessellation();
PShapeOpenGL c3d = (PShapeOpenGL)who; super.addChild(c3d); c3d.updateRoot(root); markForTessellation();
texCube.addChild(face);