Shapes #
It is possible to stylize elements with geometric forms or images.
Those shapes are only cosmetic and serve no functional purpose.
All shapes need a p or similar references node ids.
Predefined types for geometries are:
fix: Marks anodeas stationary.w0determines an angle. Default: 0.flt: Same asfix, but marksnodeas being movable translational.slider: Same asflt, but represents a movable slider.bar: Connectnodep1andnodep2using a bar.beam: Same asbar, but using only onep. Reference an angle of a constraint withwrefand define the length of the beam withlen.wheel: Draw awheelon anode.wrefa constraint for the angle.poly: Same asbeam, but instead of abeam, a polygon is drawn using aptsarray of coordinates.img: Import an image using g2's image function.
Examples #
{
"nodes": [
{ "id": "A0", "x": 75, "y": 125, "base": true },
{ "id": "A", "x": 100, "y": 175 },
{ "id": "B0", "x": 300, "y": 125 }
],
"constraints": [
{
"id": "a", "p1": "A0", "p2": "A",
"len": { "type": "const" },
"ori": { "type": "drive", "repeat": 3 }
}, {
"id": "b", "p1": "B0", "p2": "A",
"len": { "type": "const" }
}, {
"id": "c", "p1": "A0", "p2": "B0",
"ori": { "type": "const" }
}
],
"shapes": [
{ "type": "fix", "p": "A0" },
{ "type": "flt", "p": "B0" }
]
}