Polygon
polygon
A closed polygon.
The polygon is defined by its corner points and is closed automatically.
Example
#polygon(
fill: blue.lighten(80%),
stroke: blue,
(20%, 0pt),
(60%, 0pt),
(80%, 2cm),
(0%, 2cm),
)#polygon(
fill: none | color | gradient | tiling,
fill-rule: str,
stroke: none | auto | length | color | gradient | stroke | tiling | dictionary,
vertices
) -> contentParameters
- fill:
- description: How to fill the polygon. When setting a fill, the default stroke disappears. To create a rectangle with both fill and stroke, you have to configure both.
- type: none | color | gradient | tiling
- default: none
- fill-rule:
- description: The drawing rule used to fill the polygon. See the curve documentation for an example.
- type: str
- default: "non - zero"
- stroke:
- description: How to stroke the polygon. Can be set to
noneto disable the stroke or toautofor a stroke of1ptblack if and only if no fill is given. - type: none | auto | length | color | gradient | stroke | tiling | dictionary
- default: auto
- description: How to stroke the polygon. Can be set to
- vertices:
- description: The vertices of the polygon. Each point is specified as an array of two relative lengths.
- type: array
- default: None
Definitions
polygon.regular
A regular polygon, defined by its size and number of vertices.
#polygon.regular(
fill: blue.lighten(80%),
stroke: blue,
size: 30pt,
vertices: 3,
)#polygon.regular(
fill: none | color | gradient | tiling,
stroke: none | auto | length | color | gradient | stroke | tiling | dictionary,
size: length,
vertices: int
) -> contentParameters
- fill:
- description: How to fill the polygon. See the general polygon's documentation for more details.
- type: none | color | gradient | tiling
- default: None
- stroke:
- description: How to stroke the polygon. See the general polygon's documentation for more details.
- type: none | auto | length | color | gradient | stroke | tiling | dictionary
- default: None
- size:
- description: The diameter of the circumcircle of the regular polygon.
- type: length
- default: 1em
- vertices:
- description: The number of vertices in the polygon.
- type: int
- default: 3