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 id
s.
Predefined types for geometries are:
fix
: Marks anode
as stationary.w0
determines an angle. Default: 0.flt
: Same asfix
, but marksnode
as being movable translational.slider
: Same asflt
, but represents a movable slider.bar
: Connectnode
p1
andnode
p2
using a bar.beam
: Same asbar
, but using only onep
. Reference an angle of a constraint withwref
and define the length of the beam withlen
.wheel
: Draw awheel
on anode
.wref
a constraint for the angle.poly
: Same asbeam
, but instead of abeam
, a polygon is drawn using apts
array 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" }
]
}