SDF-2D - v0.8.0
    Preparing search index...
    • Creates a drawable polygon class with a shared color.

      Parameters

      Returns typeof PolygonBase

      A class with constructor new Polygon(vertices: Array<vec2>). vertices contains between one and vertexCount positions in world coordinates, ordered around the polygon's outline. Fewer vertices are padded automatically. Pass the class's static descriptor to compile!compile, then pass instances to graphics/rendering/renderer/renderer!Renderer.addDrawable.

      import { PolygonFactory } from 'sdf-2d';

      const Polygon = PolygonFactory(3, [1, 0.5, 0]);
      const polygon = new Polygon([[100, 100], [200, 100], [150, 180]]);