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:
| Property | Type | Description | Default |
|---|---|---|---|
color | Color | Color of line | Color.BLACK |
drawn | number | Proportion of the line that is drawn | 1 |
description | string | null | Accessible description of line | null |
endX | number | Ending horizontal position of line | 100 |
endY | number | Ending vertical position of line | 100 |
isDrawnFromCenter | boolean | Whether drawing should begin from line midpoint | false |
isRounded | boolean | Whether stroke has rounded line caps | false |
opacity | number | Opacity of line | 1 |
startX | number | Starting horizontal position of line | 0 |
startY | number | Starting vertical position of line | 0 |
width | number | Width of line, in pixels | 10 |
Arrow
The full list of available Arrow properties is below:
| Property | Type | Description | Default |
|---|---|---|---|
arrowheadSize | number | Size of arrowhead, in pixels | width * 4 |
color | Color | Color of arrow | Color.BLACK |
drawn | number | Proportion of the arrow that is drawn | 1 |
description | string | null | Accessible description of arrow | null |
endX | number | Ending horizontal position of arrow | 100 |
endY | number | Ending vertical position of arrow | 100 |
isArrowheadDoubled | boolean | Whether both ends of arrow should have arrowheads | false |
isArrowheadFilled | boolean | Whether arrowhead path should be filled in | false |
isDrawnFromCenter | boolean | Whether drawing should begin from line midpoint | false |
opacity | number | Opacity of line | 1 |
startX | number | Starting horizontal position of arrow | 0 |
startY | number | Starting vertical position of arrow | 0 |
width | number | Width of line, in pixels | 10 |