zMatrix()
With this type, you can visually edit a matrix in the Props Editor.
The matrix has to be "flat", for example a 2x2 matrix has to be represented as an array of 4 numbers: [0, 1, 1, 0].
The matrix has to be a square matrix, for example a 2x2, 3x3, 4x4, etc.
In the Props Editor, the values of the matrix are edited in steps of 0.01.
import {z } from 'zod';
import {zMatrix } from '@remotion/zod-types';
const myCompSchema = z .object ({
matrix : zMatrix (),
});
// Two-dimensional matrix
myCompSchema .parse ({
matrix : [0, 1, 1, 0],
});
// Three-dimensional matrix
myCompSchema .parse ({
matrix : [1, 0, 0, 0, 1, 0, 0, 0, 1],
});
// Four-dimensional matrix
myCompSchema .parse ({
matrix : [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
});Compatibility
| Browsers | Servers | Environments | |||||||
|---|---|---|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | Node.js | Bun | Serverless Functions | ||||
Schema validation works in all listed environments. The visual editor is only available in Remotion Studio.