line
line()
Draws a line, more than two points can be given to create a line-strip.
If the first or last coordinates are given as the name of an element, that has a "default" anchor, the intersection of that element’s border and a line from the first or last two coordinates given is used as coordinate. This is useful to span a line between the borders of two elements.
Styling
Root: line
Supports mark styling.
Anchors
Supports path anchors.
- centroid
- The centroid anchor is calculated for closed non self-intersecting polygons if all vertices share the same z value.
// Draw a line between two points
line((0, 0), (1.5, 1))
// Draw a line between more than two points
line((0, 0), (1, 0.5), (2, -0.5), (3, 0))
// Draw a polygon using `close: true`
line((0, 0), (0, 1), (1, 2), (2, 1), (2,0), close: true)
circle((1,2), radius: .5, name: "a")
rect((2,1), (rel: (1,1)), name: "b")
line("a", "b")
..pts-style:
coordinate or style
Positional two or more coordinates to draw lines between. Accepts style key-value pairs.