# `<trim>`

[Canonical page](https://nothing.graphics/docs/format/reference/trim) · [Page source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/docs/reference/trim.md)

Select a drawn distance interval for one stroke.

## Examples

[Download the complete .nothing source](https://nothing.graphics/format/signature-trim/source.nothing) · [Source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/conformance/signature-write-on.nothing)

Rendered with ncf-preview at 260 × 160.

- [Frame 24 · Opening loop](https://nothing.graphics/format/signature-trim/24.webp). Dark blue ink forms the opening loop. The later letter strokes and the underline are still blank.
- [Frame 72 · Final letter](https://nothing.graphics/format/signature-trim/72.webp). The stroke reaches the final letter and the underline is still absent. The pen lift adds zero length.
- [Frame 84 · Underline in progress](https://nothing.graphics/format/signature-trim/84.webp). The lettering is complete. A separate ink stroke grows from left to right beneath it.
- [Frame 96 · Complete signature](https://nothing.graphics/format/signature-trim/96.webp). The blue underline reaches its rounded final cap beneath the completed lettering.

```xml
  <shape>
    <path d="M24 91 C59 87 105 60 107 33 C109 14 86 21 74 52 C61 86 65 115 40 119 C23 122 27 102 48 101 C68 99 78 117 98 106 C109 100 117 89 120 81 C123 70 109 72 103 86 C95 104 104 112 115 103 C125 96 131 81 125 78 C120 76 118 87 130 89 C137 90 148 83 153 76 C148 85 134 109 147 109 C160 109 176 85 184 74 C178 84 163 110 176 109 C190 109 203 92 223 85 M40 140 C85 127 159 121 202 124 C217 125 232 122 243 117"/>
    <stroke stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
      <trim start="0" end="0">
        <animate attributeName="end" fill="freeze">
          <key frame="0" value="0" ease="linear"/>
          <key frame="96" value="1"/>
        </animate>
      </trim>
      <paint><solid color="#173F5BFF"/></paint>
    </stroke>
  </shape>
```



<!-- Generated by ncf/tools/reference/generate.mjs. -->

Trim measures along sampled geometry in its authored contour direction, through subpaths in order. The fill and sibling strokes keep their original geometry.

## Syntax [#syntax]

### Reveal one stripe along a bend [#reveal-one-stripe-along-a-bend]

At frame 12 the narrow stripe has covered half the 120-unit contour, ending at (76, 174). At frame 24 it reaches (96, 134). The wider casing stays complete.

```xml
<trim start="0" end="0">
  <animate attributeName="end" fill="freeze">
    <key frame="0" value="0" ease="linear"/>
    <key frame="24" value="1"/>
  </animate>
</trim>
```

[Complete .nothing source](https://github.com/gridaco/nothing/blob/main/ncf/examples/composition-card.nothing) · [Sample checks](https://github.com/gridaco/nothing/blob/main/ncf/conformance/composition-card.md)

## Usage context [#usage-context]

Allowed parents are [`<stroke>`](https://nothing.graphics/docs/format/reference/stroke).

Open and compound contours use positions in \[0, 1]. A single closed contour uses signed unwrapped laps. An end at or before the start produces no stroke coverage. Diagnose trim on text or boolean geometry.

## Attributes [#attributes]

[Property animation](https://nothing.graphics/docs/format/spec/animation#property-types-and-exceptions)

### `start` [#start]

**Value** fraction of total local contour length · **Required** · **Keys** Scalar

Start of the selected interval.

### `end` [#end]

**Value** fraction of total local contour length · **Required** · **Keys** Scalar

End of the selected interval.

## Children [#children]

| Elements                                                              | Cardinality  | Declared by | Role and source order                                                                                                                                                                                                |
| --------------------------------------------------------------------- | ------------ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`<animate>`](https://nothing.graphics/docs/format/reference/animate) | Zero or more | Animation   | A track targets one keyable property on this owner. For equal first-key times, the later track in document order wins. [Evaluating animation tracks](https://nothing.graphics/docs/format/spec/animation#evaluation) |

## Specifications [#specifications]

* [Directed contours and distance](https://nothing.graphics/docs/format/spec/contour-trim#directed-contour-and-distance)
* [Evaluating animation tracks](https://nothing.graphics/docs/format/spec/animation#evaluation)
