PolygonComponent.relative constructor
PolygonComponent.relative(})
With this constructor you define the PolygonComponent in relation to the
parentSize
of the shape.
Example: [[1.0, 0.0], [0.0, -1.0], [-1.0, 0.0], [0.0, 1.0]]
This will form a diamond shape within the bounding size box.
NOTE: Always define your shape in a counter-clockwise fashion (in the
screen coordinate system).
Implementation
PolygonComponent.relative(
List<Vector2> relation, {
required Vector2 parentSize,
Vector2? position,
Vector2? scale,
double? angle,
Anchor? anchor,
int? priority,
Paint? paint,
List<Paint>? paintLayers,
bool? shrinkToBounds,
ComponentKey? key,
List<Component>? children,
}) : this(
normalsToVertices(relation, parentSize),
position: position,
angle: angle,
anchor: anchor,
scale: scale,
priority: priority,
paint: paint,
paintLayers: paintLayers,
shrinkToBounds: shrinkToBounds,
key: key,
children: children,
);