Skip to content

CATransform3D: m34 property ​

The m34 property is the number in the third row, fourth column of the matrix. It controls perspective: set to -1 / d, the viewer is d pt from the plane of the screen. In the identity matrix it is 0, meaning no perspective.

Value ​

A number, in reciprocal pt (1/pt). Its position in the matrix:

| m11 m12 m13 m14 |
| m21 m22 m23 m24 |
| m31 m32 m33 m34 |
| m41 m42 m43 m44 |

When a point is transformed, the original z is multiplied by it and added to the new w'. At the end, x', y', and z' are all divided by w'. See how the matrix acts on a point.

  • Read-only. Assigning to it throws TypeError: m34 is read-only: structs are values, assign a whole new one instead.

Examples ​

js
const t = { ...CATransform3D.identity, m34: -1 / 500 };
const layer = new CALayer();
layer.transform = t;
console.log(layer.transform.m34);

Result: logs -0.002.

Corresponding iOS API ​

The C struct field CATransform3D.m34.

See also ​