Documentation
    Preparing search index...

    Interface StrokeStyle

    §58's StrokeStyle — how a shape's outline is drawn.

    const outline: StrokeStyle = {
    width: 0.04,
    paint: { kind: "solid", color: [1, 1, 1, 1] },
    lineJoin: "round",
    dash: [0.2, 0.1],
    };

    §58 declares every field as required; this one defaults all but width, following the family's standing rule that a parameter is required exactly when it is the thing — a stroke is its width, and there is no width an engine can invent, while miter/butt/center are the answers SVG, Canvas and §58's own ordering already agree on. The defaults are named on each field and restated in Appendix A terms by expandStroke.

    The geometric half is @fourjs/geometry's StrokeGeometryOptions, which this interface re-declares minus its tolerance — a shape has its own Shape2D.tolerance and stroking at a different one than the flattening would put facets on a curve that has none — and plus §58's paint, which the geometry package cannot see because a colour is not geometry.

    Validated and copied on assignment (§85): reading gives a fresh record with every optional field resolved, so an in-place edit of the object you passed cannot desynchronise the geometry from the style that produced it — the hazard Polygon.points has to document instead.

    interface StrokeStyle {
        alignment?: StrokeAlignment;
        dash?: readonly number[];
        dashOffset?: number;
        lineCap?: StrokeLineCap;
        lineJoin?: StrokeLineJoin;
        miterLimit?: number;
        paint?: Paint;
        width: number;
    }
    Index
    alignment?: StrokeAlignment

    Which side of the outline the band sits on; defaults to "center".

    dash?: readonly number[]

    Alternating on/off lengths in world units (§50 "dashes and dash offset"). Omit for a solid stroke; an odd count is repeated, SVG's rule.

    dashOffset?: number

    How far into the dash pattern the outline starts; defaults to 0.

    lineCap?: StrokeLineCap

    How open ends are finished; defaults to "butt".

    lineJoin?: StrokeLineJoin

    How corners are filled; defaults to "miter".

    miterLimit?: number

    Ratio of miter length to width past which a "miter" join is drawn as a "bevel"; at least 1, defaults to 4 (SVG's and Canvas's).

    paint?: Paint

    What the band is painted with (§58). Omitted, the band is drawn in the material's own colour with no per-vertex colour — which is what a stroke-only shape like Line wants, and why it is optional.

    width: number

    Total width of the band in world units; finite and positive (§85). Required — see the interface documentation.