---
title: "strokedSegment"
description: "A straight line between two points, solid, dashed or dotted, with square or round ends."
group: "paint"
groupTitle: "Painting"
categoryId: "figures"
categorySlug: "figures"
categoryTitle: "Figures & strokes"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/figures.ts#L77"
---

# strokedSegment

A straight line between two points, solid, dashed or dotted, with square or round ends.

```ts
strokedSegment(slots: StrokedSegmentSlots): Paint
```

Import `figures` from `shaders/std` and use `figures.strokedSegment`.

Dashes and dots are spaced so the pattern lands exactly on both endpoints. The edge stays antialiased at any thickness. Style and cap inputs are numbers, so give a select prop a `transform` that maps its labels to them, or pass the number directly.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `slots` | `StrokedSegmentSlots` |  |

## Example

```ts
paint: strokedSegment({from: p('pointA'), to: p('pointB'), width: p('thickness'), style: 1, dashLength: p('dashLength'), gapLength: p('gapLength'), capStart: 1, capEnd: 1, color: p('color')})
```

## See also

- [`sineStroke`](/docs/primitives/figures/sinestroke) — A wavy line that travels along itself, drawn as a soft band.

## Used by

[Line](/docs/components/line)