Skip to content

Instantly share code, notes, and snippets.

@netopyr
Last active December 15, 2015 12:09
Show Gist options
  • Save netopyr/5258634 to your computer and use it in GitHub Desktop.
Save netopyr/5258634 to your computer and use it in GitHub Desktop.
Attaching visual elements to the dummy
// Definition of head
final Bone head = new Bone(30, 90);
head.getContent().add(new Ellipse(20, 15));
// Definition of torso
final Bone torso = new Bone(80, 0);
torso.getContent().add(new Ellipse(40, 0, 50, 20));
head.getChildren().add(torso);
final Bone[] upperArm = new Bone[2];
final Bone[] upperLeg = new Bone[2];
for (int i=0; i<2; i++) {
// Definition upper arms
upperArm[i] = new Bone(60, 60 - 90 * i);
upperArm[i].getContent().add(new Ellipse(22.5, 0, 30, 12.5));
// Definition of lower arms
final Bone lowerArm = new Bone(60, -90);
lowerArm.getContent().addAll(
new Circle(12.5),
new Ellipse(30, 0, 20, 12.5),
new Circle(60, 0, 12.5)
);
upperArm[i].getChildren().add(lowerArm);
// Definition of upper legs
upperLeg[i] = new Bone(60, 30 - 90*i);
upperLeg[i].getContent().add(new Ellipse(20, 0, 30, 15));
// Definition of lower legs
final Bone lowerLeg = new Bone(75, 90);
lowerLeg.getContent().addAll(
new Circle(15),
new Ellipse(40, 0, 30, 15),
new Ellipse(75, -10, 10, 22.5)
);
upperLeg[i].getChildren().add(lowerLeg);
}
// Connect arms and legs to head and torso
head.getChildren().addAll(upperArm);
torso.getChildren().addAll(upperLeg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment