# Registration

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

Choose which point of a rectangle, circle, or ellipse sits at the local offset.



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

Anchor fractions select a point relative to the unpainted geometry bounds. The two offset attributes give that point’s drawable-local coordinates.

## Example [#example]

### Pin a rectangle by its left midpoint [#pin-a-rectangle-by-its-left-midpoint]

Registration belongs to `<rect>`, `<circle>`, and `<ellipse>`. Write `anchor-u="0"` on the rectangle to select its left edge. The omitted `anchor-v` still selects halfway down. The shape places that left midpoint at (56, 24), and the white rectangle extends from x = 56 to 66 and y = 21 to 27. Set `anchor-v="0"` as well to place the top-left corner at the shape origin. Use `offset-x` or `offset-y` on the geometry when the selected point needs to sit away from the origin.

```xml
<shape translate-x="56" translate-y="24">
  <rect width="10" height="6" anchor-u="0"/>
  <fill><paint><solid color="#FFFFFFFF"/></paint></fill>
</shape>
```

[Complete .nothing source](https://github.com/gridaco/nothing/blob/main/ncf/conformance/boxed-geometry/centered-rectangle.nothing)

## Usage context [#usage-context]

Trait `Registration` in the [scene format type model](https://nothing.graphics/docs/format/spec/type-model).

Related pages in this reference are [`<rect>`](https://nothing.graphics/docs/format/reference/rect), [`<circle>`](https://nothing.graphics/docs/format/reference/circle), [`<ellipse>`](https://nothing.graphics/docs/format/reference/ellipse).

## Attributes [#attributes]

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

### `anchor-u` [#anchor-u]

**Value** fraction of width · **If omitted** `0.5` · **Keys** Scalar

Horizontal registration. Zero selects the left edge and one the right edge. Values outside that interval extrapolate.

### `anchor-v` [#anchor-v]

**Value** fraction of height · **If omitted** `0.5` · **Keys** Scalar

Vertical registration. Zero selects the top edge and one the bottom edge. Values outside that interval extrapolate.

### `offset-x` [#offset-x]

**Value** local units · **If omitted** `0` · **Keys** Scalar

Horizontal coordinate of the registered point.

### `offset-y` [#offset-y]

**Value** local units · **If omitted** `0` · **Keys** Scalar

Vertical coordinate of the registered point.

## Specifications [#specifications]

* [Size, registration and offset](https://nothing.graphics/docs/format/spec/boxed-geometry#size-registration-and-offset)
