# Transform

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

Move, scale, skew, or rotate a drawable in its parent.



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

Scale, then skew, then rotate around the local pivot. Translation moves the result along the parent’s axes.

## Example [#example]

### Turn a rectangle around its center [#turn-a-rectangle-around-its-center]

Transform attributes belong to `<shape>`, `<group>`, and `<sequence>`. Here the shape translates to (32, 24) and keys its own `rotate` attribute. At frame 0 the painted rectangle is 12 × 8. At frame 4 it has turned 90° clockwise and paints an 8 × 12 area. The shape’s default pivot is local (0, 0), the point where the rectangle’s default registration places its center. The center therefore stays at (32, 24) during the turn.

```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>
```

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

## Usage context [#usage-context]

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

Related pages in this reference are [Drawable](https://nothing.graphics/docs/format/reference/drawable).

## Attributes [#attributes]

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

### `translate-x` [#translate-x]

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

Horizontal translation.

### `translate-y` [#translate-y]

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

Vertical translation.

### `pivot-x` [#pivot-x]

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

Horizontal coordinate of the transform pivot.

### `pivot-y` [#pivot-y]

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

Vertical coordinate of the transform pivot.

### `scale-x` [#scale-x]

**Value** factor · **If omitted** `1` · **Keys** Scalar

Local horizontal scale. Negative values reflect the axis.

### `scale-y` [#scale-y]

**Value** factor · **If omitted** `1` · **Keys** Scalar

Local vertical scale. Negative values reflect the axis.

### `skew-x` [#skew-x]

**Value** degrees · **If omitted** `0` · **Keys** Scalar

Horizontal shear angle, strictly between −90 and 90.

### `rotate` [#rotate]

**Value** degrees · **If omitted** `0` · **Keys** Scalar

Rotation about the drawable pivot, clockwise in default scene coordinates.

## Specifications [#specifications]

* [Local-to-parent transforms](https://nothing.graphics/docs/format/spec/spatial#local-to-parent)
