Skip to content

Matrix

matrix

A transformation matrix specification, used to transform the geometry of objects. Use it to specify and retrieve matrix information from an Illustrator document or from page items in a document.

Matrices are used in conjunction with the transform method and as a property of a number of objects. A matrix specifies how to transform the geometry of an object. You can generate an original matrix using the Application object methods Application.getTranslationMatrix(), Application.getScaleMatrix(), or Application.getRotationMatrix().

A Matrix is a record containing the matrix values, not a reference to a matrix object. The matrix commands operate on the values of a matrix record. If a command modifies a matrix, a modified matrix record is returned as the result of the command. The original matrix record passed to the command is not modified.


matrix.mValueA

Matrix property a.

Number (double).


matrix.mValueB

Matrix property b.

Number (double).


matrix.mValueC

Matrix property c.

Number (double).


matrix.mValueD

Matrix property d.

Number (double).


matrix.mValueTX

Matrix property tx.

Number (double).


matrix.mValueTY

Matrix property ty.

Number (double).


matrix.typename

The class name of the referenced object.

String; read-only.


Combining matrices to apply multiple transformations

Section titled “Combining matrices to apply multiple transformations”

To apply multiple transformations to objects, it is more efficient to use the matrix suite than to apply the transformations one at a time. The following script demonstrates how to combine multiple matrices.

// Tranforms all art in a document using translation and rotation matrices,
// moves art half an inch to the right and 1.5 inches up on the page
if (app.documents.length > 0) {
var moveMatrix = app.getTranslationMatrix(0.5, 1.5);
// Add a rotation to the translation, 10 degrees counter clockwise
var totalMatrix = concatenateRotationMatrix(moveMatrix, 10);
// apply the transformation to all art in the document
var doc = app.activeDocument;
for (var i = 0; i < doc.pageItems.length; i++) {
doc.pageItems[i].transform(totalMatrix);
}
}