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,
bool? shrinkToBounds,
}) : this(
normalsToVertices(relation, parentSize),
position: position,
size: parentSize,
angle: angle,
anchor: anchor,
scale: scale,
priority: priority,
paint: paint,
shrinkToBounds: shrinkToBounds,
);