Skip to content

createLinePath

Read as Markdown

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

LinePathOptions is accepted by createLinePath(options): Path2D, which creates a fresh path from finite numeric coordinate pairs and optional closePath. It is pure, and does not attach paint, events, or caching.

<Path
style={{
d: createLinePath({
coords: [
[0, 0],
[80, 40],
[160, 0],
],
}),
stroke: "#2563eb",
}}
/>

Try the Line live example.

Creates a Canvas Path2D for line geometry from validated options.

createLinePath: (options: Readonly<LinePathOptions>) => Path2D

Related API: createLinePath, LinePathOptions.

  • options — Ordered vertices and whether to close the path. See LinePathOptions.

A native Canvas path containing the line.

LinePathOptions

View source — packages/core/src/lib/geometry/line.ts:23

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.