Skip to content
Apexify.jsDocs
Apexify.js version v5.4.5

Node / Lines Connectors · guide

lineStyle & path

Current Apexify.js 6.0.0 documentation for lineStyle & path.

apexify.jsRuntime: nodeCURRENTSince 6.0.0

Optional lineStyle on each CustomOptions controls stroke appearance (custom-lines.ts). path selects how the canvas builds geometry between start and end.


lineStyle (implemented)

FieldRole
widthctx.lineWidth (default 1).
colorstrokeStyle when gradient omitted (default 'black').
gradientcreateGradientFill with bbox { x: start.x, y: start.y, w: end.x-start.x, h: end.y-start.y } — same gradient union as backgrounds.
lineJoinround | bevel | miter (default miter).
lineCapbutt | round | square (default butt). Numeric lineRadius forces round caps before the tube fill pass.
singleLineChain consecutive CustomOptions into one open path — see Custom API.
lineDashdashArray, offset — ctx.setLineDash. Ignored when pattern is set (pattern wins).
patternapplyLinePattern presets dots, dashes, custom segments — see Markers chapter.
textureapplyLineTexture — loads image (URL, Buffer, or filesystem path via process.cwd()) and sets strokeStyle to createPattern(..., 'repeat').
lineRadiusnumber — rounded “tube”: stroke segment then arc fills at both endpoints · 'circular' — arcTo capsule outline (different geometry, separate stroke only).
strokeSecond-pass halo outline sharing the same segment (applyStroke helper): optional color/gradient/width/lineCap/lineRadius.

Declared but not wired

lineStyle.shadow exists on CustomOptions but custom-lines.ts never reads it. Bake shadows via path2d.draw (Path2DDrawOptions.shadow) or external blur until wired.


path — curvature between start and end

SOURCEtypescript
typescript
Studio
path?: {  type: 'smooth' | 'bezier' | 'catmull-rom';  tension?: number;   // default 0.5  closed?: boolean;   // default false};

Each CustomOptions row contributes allPoints = [startCoordinates, endCoordinates] (two anchors).

typeBehaviour with two points
smoothcreateSmoothPath → lineTo shortcut (needs ≥ 3 points for curvature).
catmull-romcreateCatmullRomPath → straight lineTo for two knots.
bezierRequires ≥ 4 points for the bezierCurveTo branch — never satisfied by the current CustomOptions shape, so execution falls through to lineTo(end).

For real Bézier chains, arcs, or stars use path2d.create + PathCommand[] — see Path2D.


Execution order (per segment)

Rough order: dash/pattern → texture strokeStyle → stroke (possibly twice when numeric lineRadius adds tube fill) → lineStyle.stroke halo → arrows → markers.

Consult custom-lines.ts when stacking texture + gradient — texture replaces strokeStyle after gradients are assigned.


Next steps