# What stays fixed when I rotate or resize?

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

Rotate a drawable or change its dimensions around a chosen point.



Set [`rotate` on the shape](https://nothing.graphics/docs/format/reference/transform#rotate) to turn its picture about the drawable’s pivot. Set [`width` on the rectangle](https://nothing.graphics/docs/format/reference/rect#width) to change its local geometry about the registration point. Both points start at the shape’s local origin in the [sampled rectangle scene](https://github.com/gridaco/nothing/blob/main/ncf/conformance/boxed-geometry/centered-rectangle.nothing).

## Keep the center fixed [#keep-the-center-fixed]

The first shape’s translation places its local origin at (32, 24). Its rectangle uses the default center registration. The shape owns the rotation track and the rectangle owns a separate width track.

| Frame | Shape rotation | Local rectangle size | Painted footprint in scene coordinates |
| ----- | -------------- | -------------------- | -------------------------------------- |
| 0     | 0°             | 12 × 8               | 12 × 8                                 |
| 4     | 90° clockwise  | 12 × 8               | 8 × 12                                 |
| 8     | 90° clockwise  | 20 × 8               | 8 × 20                                 |

The footprint stays centered at (32, 24). At frame 8 the 20-unit local X dimension appears vertical because the shape’s rotation applies after computing its local geometry.

## Keep the left edge mounted [#keep-the-left-edge-mounted]

Set [`anchor-u="0"`](https://nothing.graphics/docs/format/reference/registration#anchor-u) on the first rectangle and leave `anchor-v` at its default of 0.5. Its local left-edge midpoint now sits at the shape pivot, (32, 24) in the scene. At frame 8 the rotated rectangle extends downward from y = 24 to 44.

Set a [geometry offset](https://nothing.graphics/docs/format/reference/registration#offset-x) to move the registration point within the drawable. Set a [drawable pivot](https://nothing.graphics/docs/format/reference/transform#pivot-x) to move the rotation point. Use a group to transform several drawables together, or a locator to [keep a child mounted on the geometry](https://nothing.graphics/docs/format/guides/attach-geometry). [Registration and offset](https://nothing.graphics/docs/format/spec/boxed-geometry#size-registration-and-offset) · [Local-to-parent transforms](https://nothing.graphics/docs/format/spec/spatial#local-to-parent)

## Examples

The shape owns the rotation. The rectangle owns its local width. The shape’s translation and the rectangle’s default center registration keep the painted rectangle centered at (32, 24).

[Download the complete .nothing source](https://nothing.graphics/format/centered-rectangle/source.nothing) · [Source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/conformance/boxed-geometry/centered-rectangle.nothing)

Rendered with ncf-preview at 80 × 56.

- [Frame 0 · Initial pose](https://nothing.graphics/format/centered-rectangle/0.webp). A 12 × 8 white rectangle centered at (32, 24). Three smaller registration examples sit to its right.
- [Frame 4 · Quarter turn](https://nothing.graphics/format/centered-rectangle/4.webp). The rectangle turns 90° clockwise. Its painted extent is 8 × 12 and its center stays at (32, 24).
- [Frame 8 · Wider rectangle](https://nothing.graphics/format/centered-rectangle/8.webp). The local width increases to 20 while the quarter turn holds. The painted extent is 8 × 20 and its center stays at (32, 24).

```xml
  <shape translate-x="32" translate-y="24">
    <animate attributeName="rotate" fill="freeze">
      <key frame="0" value="0" ease="linear"/>
      <key frame="4" value="90"/>
    </animate>
    <rect width="12" height="8">
      <animate attributeName="width" fill="freeze">
        <key frame="4" value="12" ease="linear"/>
        <key frame="8" value="20"/>
      </animate>
    </rect>
    <fill><paint><solid color="#FFFFFFFF"/></paint></fill>
  </shape>
```
