Skip to content

DrawLine

Draws a straight line on the canvas.

Usage

tsx
import { Canvas, DrawLine } from 'flexium/canvas';

<Canvas width={200} height={200}>
  <DrawLine
    x1={10}
    y1={10}
    x2={100}
    y2={100}
    stroke="red"
    strokeWidth={5}
  />
</Canvas>

Props

PropTypeDescription
x1number | Signal<number>Start x-coordinate.
y1number | Signal<number>Start y-coordinate.
x2number | Signal<number>End x-coordinate.
y2number | Signal<number>End y-coordinate.
strokestring | Signal<string>The line color.
strokeWidthnumber | Signal<number>The width of the line.
opacitynumber | Signal<number>Opacity (0 to 1).

Released under the MIT License.