## Transforms and coordinates

A complete ordinary 2D transform:

```json
{"a":{"a":0,"k":[0,0,0]},"p":{"a":0,"k":[320,180,0]},"s":{"a":0,"k":[100,100,100]},"r":{"a":0,"k":0},"o":{"a":0,"k":100}}
```

| Property | Type | Default | Notes |
| --- | --- | --- | --- |
| `ks.a` | property: 2 or 3 numbers | `[0,0,0]` | Anchor, in the layer's local pixels |
| `ks.p` | property: 2 or 3 numbers, or [separated](#separated-position) | `[0,0,0]` | Position of the anchor, in parent coordinates |
| `ks.s` | property: 2 or 3 numbers | `[100,100,100]` | Scale in percent: `[100,100,100]` is unchanged |
| `ks.r` | property: number | 0 | 2D rotation in degrees. Ignored when `rx` is present. |
| `ks.o` | property: number | Required | Opacity, 0–100 |
| `ks.rx`, `ks.ry`, `ks.rz` | property: number | 0 | 3D rotations in degrees. Supply all three when you preserve a 3D rig. |
| `ks.or` | property: 3 numbers | `[0,0,0]` | Orientation in degrees. Keyframes may hold two or three numbers. |
| `ks.poff` | list of 2 numbers | None | A static `[x,y]` offset. Preserve it and never keyframe it. To move a layer, change `p`. |
| `ao` | whole number | 0 | A nonzero value turns the layer to the tangent of a unified animated position track. Separated `x` and `y` cannot drive it. |

Expressions run on `p`, `a`, `s`, `r` and `o` only ([expressions](#expressions)). Layer `ddd` is not read: 3D comes from `rx`, `ry`, `rz` and three-component `p`, `s` and `a`. Timing is in [time](#time).

### Where a layer sits

- Position places the anchor. It does not center the visible content.
- Solids and images have their origin at the upper-left corner. A full-canvas solid with anchor `[0,0,0]` needs position `[0,0,0]`. Or anchor it at half its width and height, and position that at the canvas center.
- Image anchors usually sit at half the image's size. Shape geometry is often centered on the origin: a rectangle with its own `p: [0,0]` is centered there. Text position is tied to a baseline, not to the center of the visible text.
- A child uses its parent's coordinates. Don't apply the canvas-center offset again to each child.
- With no rotation or parent, a local point lands at `position + (point - anchor) * scale / 100`. Parenting, group and precomposition transforms compose on top.
- Convert a measured canvas distance to parent coordinates before you change a position. Setting a nested layer's `p` to the root canvas center does not center its subject.
- 2D and 3D vectors are not interchangeable with scalar wrappers: keep each value's dimensions.
- Moving an anchor changes the picture, unless position compensates through scale and rotation at every affected time. For a move, offset the position and keep the anchor.

### Separated position

```json
{"s":true,"x":{"a":0,"k":320},"y":{"a":0,"k":180}}
```

Here `s` is a separation flag, not scale. Edit `/ks/p/x` and `/ks/p/y` as scalar properties, and add no vector `k`. A separated position has X and Y only, so a 3D layer uses a unified three-component position. It gives auto-orient no tangent.

### Edge cases

- With both `rx` and `r`, `r` is ignored (`warnings`).
- An `or` without three numbers, such as `[]`: `problems`.
- A `poff` the engine cannot read, such as `[]` or `null`: `problems`. On a layer whose transform has no `"a": 1` value or expression, even `[1,2]` can be.
- Only `s: true` separates a position: `s: 1` does not. The engine then reads the position's `k`, which a separated position lacks, so the layer stays at 0,0 (`warnings`).
- A separated position ignores `z` (`warnings`).
- A separated position with an `x` gives the layer an [animator](#which-layers-can-animate), so its keyframes animate on any layer. Without `x`, keyframes in `y` are `problems` on a layer with no other animation.
