PolygonComponent.relative constructor

PolygonComponent.relative(
  1. List<Vector2> relation, {
  2. required Vector2 parentSize,
  3. Vector2? position,
  4. Vector2? scale,
  5. double? angle,
  6. Anchor? anchor,
  7. int? priority,
  8. Paint? paint,
  9. List<Paint>? paintLayers,
  10. bool? shrinkToBounds,
  11. ComponentKey? key,
  12. List<Component>? children,
})

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,
      );