# Animate a property

[Canonical page](https://nothing.graphics/docs/format/guides/animate-a-property) · [Page source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/docs/guides/animate-a-property.md)

Place keys on the property owner and predict the sampled value between keys.



Put `animate` directly inside the element that owns the property. Key a shape’s `translate-x` to move its whole picture, a rectangle’s `width` to resize its contour, or a child shape’s `along` to move it on its host’s contour. For each track, declare an authored scene `frame-rate` and at least two strictly increasing keys. Keep a valid base value on the owner when the property requires one. [Track authoring and key ownership](https://nothing.graphics/docs/format/spec/animation#authoring)

## Match a moving marker to a stroke reveal [#match-a-moving-marker-to-a-stroke-reveal]

In the [runnable road scene](https://github.com/gridaco/nothing/blob/main/ncf/conformance/attached-drawables/01-road-arrow.nothing), the marker starts with `along="0"`. Its track advances the locator from 0 on frame 0 to 1 on frame 24. The stripe uses the same keys for the `end` on its `trim`. The road travels 60 units right, then 40 units down, with its origin translated to (16, 16).

| Sample   | Locator and trim end | Marker origin in the scene |
| -------- | -------------------- | -------------------------- |
| Frame 0  | 0                    | (16, 16)                   |
| Frame 12 | 0.5                  | (66, 16), facing right     |
| Frame 18 | 0.75                 | (76, 31), facing down      |
| Frame 24 | 1                    | (76, 56), facing down      |

The ease on the first key applies to the segment leaving it. `linear` gives the halfway value at frame 12. Try `ease="hold"` on both tracks’ first keys. At frame 12 the marker stays at the start and the stripe remains empty. Frame 24 still reaches the end because both tracks use `fill="freeze"`. Change both tracks to `fill="remove"` and frame 24 instead returns to the authored base values of zero. [Track evaluation and repeat boundaries](https://nothing.graphics/docs/format/spec/animation#evaluation)

A frame address follows the authored rate. At 24 fps, `frame="12"` and `time="0.5s"` denote the same instant, so they would be duplicate addresses in the same track. At 30 fps, frame 12 moves to 0.4 seconds and the seconds address stays at 0.5. For a track inside another composition, resolve the [owning clock](https://nothing.graphics/docs/format/guides/sequences-and-audio) first.

## Examples

[Download the complete .nothing source](https://nothing.graphics/format/moving-locator/source.nothing) · [Source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/conformance/attached-drawables/01-road-arrow.nothing)

Rendered with ncf-preview at 128 × 96.

- [Frame 0 · Start](https://nothing.graphics/format/moving-locator/0.webp). An amber marker sits at the start of a dark road. The white stripe has zero length.
- [Frame 12 · Halfway](https://nothing.graphics/format/moving-locator/12.webp). The stripe has painted 50 of the road’s 100 local units. The marker points right from (66, 16).
- [Frame 18 · Around the corner](https://nothing.graphics/format/moving-locator/18.webp). The stripe runs 15 units down the vertical leg. The marker points down from (76, 31).
- [Frame 24 · End](https://nothing.graphics/format/moving-locator/24.webp). The stripe covers both legs. The marker points off the end of the vertical leg at (76, 56).

```xml
  <shape translate-x="16" translate-y="16">
    <polyline points="0,0 60,0 60,40"/>
    <stroke stroke-width="12">
      <paint><solid color="#2C313CFF"/></paint>
    </stroke>
    <stroke stroke-width="6">
      <trim start="0" end="0">
        <animate attributeName="end" fill="freeze">
          <key frame="0" value="0" ease="linear"/>
          <key frame="24" value="1"/>
        </animate>
      </trim>
      <paint><solid color="#F4F4F5FF"/></paint>
    </stroke>
    <shape along="0" orient="auto">
      <polygon points="-2,-6 8,0 -2,6"/>
      <fill><paint><solid color="#FFC23DFF"/></paint></fill>
      <animate attributeName="along" fill="freeze">
        <key frame="0" value="0" ease="linear"/>
        <key frame="24" value="1"/>
      </animate>
    </shape>
  </shape>
```
