pixi-reels

API reference

roundRectPath

pixi-reels


pixi-reels / debug / roundRectPath

function roundRectPath(
   g: SilkGraphics, 
   x: number, 
   y: number, 
   width: number, 
   height: number, 
   radius?: number
): SilkGraphics;

Defined in: debug/roundRectPath.ts:19

Add a rounded rectangle to g as one closed PATH instead of a shape, and return g so the stroke chains on.

pixi-silk 0.1 dashes paths and ellipses, but strokes rect / roundRect solid whatever dash says. Stroke what this adds and the dashes come out, running continuously round the corners:

roundRectPath(g, x, y, w, h, 4).stroke({ width: 1.5, color: 0xfef08a, dash: [7, 5] });

The corners are quadratic curves, which sit within a fraction of a pixel of a circular arc at the radii a debug outline uses. Paths stroke centred on the line, so inset by half the stroke width to keep it inside a box.

Parameters#

ParameterTypeDefault value
gSilkGraphicsundefined
xnumberundefined
ynumberundefined
widthnumberundefined
heightnumberundefined
radiusnumber0

Returns#

SilkGraphics