Skip to main content

Lines

Use Line for a segment between two points and Arrow when that segment needs an arrowhead.

import { Arrow, Color, Line } from "presenter";
const line = Line({  startX: 500,  startY: 800,  endX: 3340,  endY: 800,  width: 32,  color: Color("#60a5fa"),  isRounded: true,});
const arrow = Arrow({  startX: 500,  startY: 1450,  endX: 3340,  endY: 1450,  width: 32,  arrowheadSize: 150,  color: Color("#fbbf24"),  isArrowheadFilled: true,});

Both objects use startX, startY, endX, and endY for their endpoints, width for stroke thickness, and color for the stroke. Animate drawn between 0 and 1 for a drawing effect.

Line

The full list of available Line properties is below:

PropertyTypeDescriptionDefault
colorColorColor of lineColor.BLACK
drawnnumberProportion of the line that is drawn1
descriptionstring | nullAccessible description of linenull
endXnumberEnding horizontal position of line100
endYnumberEnding vertical position of line100
isDrawnFromCenterbooleanWhether drawing should begin from line midpointfalse
isRoundedbooleanWhether stroke has rounded line capsfalse
opacitynumberOpacity of line1
startXnumberStarting horizontal position of line0
startYnumberStarting vertical position of line0
widthnumberWidth of line, in pixels10

Arrow

The full list of available Arrow properties is below:

PropertyTypeDescriptionDefault
arrowheadSizenumberSize of arrowhead, in pixelswidth * 4
colorColorColor of arrowColor.BLACK
drawnnumberProportion of the arrow that is drawn1
descriptionstring | nullAccessible description of arrownull
endXnumberEnding horizontal position of arrow100
endYnumberEnding vertical position of arrow100
isArrowheadDoubledbooleanWhether both ends of arrow should have arrowheadsfalse
isArrowheadFilledbooleanWhether arrowhead path should be filled infalse
isDrawnFromCenterbooleanWhether drawing should begin from line midpointfalse
opacitynumberOpacity of line1
startXnumberStarting horizontal position of arrow0
startYnumberStarting vertical position of arrow0
widthnumberWidth of line, in pixels10