Layer Polygon attribute¶
- class Polygon¶
This layer attribute provides a way of drawing polygons with varying number of
sides
.Note
The position of the polygon may not always be centered as it depends on the specification of
sides
.Seealso
The size of the rendered polygon is constrained by how the
sides
are specified. Please review the 2 distinct ways to specify a polygon’ssides
.- sides : Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | List[Offset]¶
The specification of the polygon’s sides. This can be an integer or a YAML list of
offset
s.- Using an Integer (regular polygon):¶
The number of sides that defines the edge of the polygon. This cannot be less than
3
if specified as an integer.Area of polygons are restricted
If
sides
is an integer, then the rendered polygon is limited to the area of a circle within the layer. In this case, the layer’ssize
determines the size of the polygon, but the layersize
should form a perfect square to maximize the area that the polygon occupies. If thesize.width
andsize.height
are not equal, then the smaller of the two is used to limit the size of the polygon.- Using a YAML list of offsets (custom polygon):¶
This can also be a YAML list of
offset
s in which each specifiedoffset
is a point relative to the top-left corner of the layer.
- rotation : float¶
The angles (in degrees) of arbitrary rotation (increasing counter-clockwise).
Error
If the
sides
attribute specifies a YAML list ofoffset
s, then any specifiedrotation
is ignored (treated as0
).
- color : Color | Linear_Gradient | Radial_Gradient | Conical_Gradient | None¶
The shape’s fill color.
Seealso
Please review Choosing a color section for more detail.