mwg API
    Preparing search index...

    Class Shape2D

    Vector drawing - rectangles, circles, polygons, lines - under an MWG-owned name.

    Pixi's own Graphics API (.rect(...).fill(...), .circle(...).stroke(...), moveTo/ lineTo) is already the right shape for this; wrapping it class-for-method would only duplicate an API this project does not own and would drift from every Pixi upgrade. The bare re-export is what lets a game draw shapes without importing pixi.js itself.

    import { Shape2D } from '@datamoc/mwg/two-d/render';

    const marker = new Shape2D().circle(0, 0, 6).fill(0xff4040).stroke({ color: 0x000000, width: 1 });
    marker.x = 100;
    marker.y = 60;

    Hierarchy

    • Graphics
      • Shape2D
    Index
    • Creates a new Graphics object.

      Parameters

      • Optionaloptions: GraphicsContext | GraphicsOptions

        Options for the Graphics.

      Returns Shape2D

    • Adds a dashed line from (x1, y1) to (x2, y2) as separate segments, to be stroked like any other path: shape.dashedLine(0, 0, 100, 0, 6, 4).stroke({ color: 0xffffff, width: 1 }). Pixi strokes are solid only, so the dashes are built here, the pattern starting at the first point.

      Parameters

      • x1: number
      • y1: number
      • x2: number
      • y2: number
      • dash: number = 6
      • gap: number = 4

      Returns this