Skip to content

createPolygonPath

Read as Markdown

import { createPolygonPath, Path } from "@pibbl/core";

PolygonPathOptions is accepted by createPolygonPath(options): Path2D, which creates a fresh closed path from finite numeric pairs, with optional numeric corner radii. Short lists are safe empty geometry; no render state or events are owned.

<Path
style={{
d: createPolygonPath({
coords: [
[0, 80],
[50, 0],
[100, 80],
],
}),
fill: "#f59e0b",
}}
/>

See the Polygon live example.

Creates a Canvas Path2D for polygon geometry from validated options.

createPolygonPath: (options: Readonly<PolygonPathOptions>) => Path2D

Related API: createPolygonPath, PolygonPathOptions.

  • options — Ordered polygon vertices and corner rounding settings. See PolygonPathOptions .

A native Canvas path containing the polygon.

PolygonPathOptions

View source — packages/core/src/lib/geometry/polygon.ts:25

Read the Drawing, layout, and effects companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.

Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.