Skip to content

createRegularPolygonPath

Read as Markdown

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

RegularPolygonPathOptions is accepted by createRegularPolygonPath(options): Path2D, which requires integer sides >= 3 and exactly one numeric size field. Optional position, rotation, and numeric corner radii produce a fresh pure path.

<Path
style={{
d: createRegularPolygonPath({ sides: 6, circumradius: 48 }),
fill: "#22c55e",
}}
/>

See the Regular polygon live example.

Creates a Canvas Path2D for regular polygon geometry from validated options.

createRegularPolygonPath: (options: Readonly<RegularPolygonPathOptions>) => Path2D

Related API: createRegularPolygonPath, RegularPolygonPathOptions.

A native Canvas path containing the regular polygon.

RegularPolygonPathOptions

View source — packages/core/src/lib/geometry/regular-polygon.ts:167

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.