GeometricRenderer

The GeometricRenderer component draws hollow (stroke-only) geometry: polygon outlines, lines, and circle outlines. It uses the entity’s Transform for position, scale, and rotation. See Rendering for an overview.

Options

OptionTypeDefaultDescription
shapeGeometricShapeGeometricShape.PolygonGeometricShape.Polygon, GeometricShape.Line, or GeometricShape.Circumference.
colorstring"#FFFFFF"Stroke color.
vertexModelVector2[][]Vertices in local space. For Polygon, at least three points (drawn as a closed loop). For Line, an even number of points (pairs). Ignored for Circumference.
radiusnumber0Radius in pixels. Circumference only.
offsetVector2(0, 0)Offset from the entity’s position.
rotationnumber0Rotation in radians, added to the Transform’s rotation.
layerstring"Default"The render layer.

Nothing is drawn if the geometry is invalid: a circumference needs radius > 0, a polygon needs at least three vertices, and a line needs at least two vertices and an even count.

Example

import { Transform, GeometricRenderer, GeometricShape, Vector2 } from "angry-pixel";

this.entityManager.createEntity([
    new Transform(),
    new GeometricRenderer({
        shape: GeometricShape.Circumference,
        color: "#00FF88",
        radius: 32,
        layer: "Default",
    }),
]);