Copy link to clipboard
Copied
Try below code:
function applyTM(tg, a, b, c, d) {
var tm = new Matrix();
tm.mValueA = a;
tm.mValueB = b;
tm.mValueC = c;
tm.mValueD = d;
tm.mValueTX = 0;
tm.mValueTY = 0;
tg.transform(tm,true,true,true,true,1);
app.redraw();
}
applyTM (app.activeDocument.selection[0],-1,0,0,1);
if you want to transform horizontal:
applyTM (app.activeDocument.selection[0],1,0,0,-1);
Ten
Copy link to clipboard
Copied
Copy link to clipboard
Copied
hello,
are there any way to do that in java script not apple
Object > Transform > Reflect, across the Vertical axis
Copy link to clipboard
Copied
Try below code:
function applyTM(tg, a, b, c, d) {
var tm = new Matrix();
tm.mValueA = a;
tm.mValueB = b;
tm.mValueC = c;
tm.mValueD = d;
tm.mValueTX = 0;
tm.mValueTY = 0;
tg.transform(tm,true,true,true,true,1);
app.redraw();
}
applyTM (app.activeDocument.selection[0],-1,0,0,1);
if you want to transform horizontal:
applyTM (app.activeDocument.selection[0],1,0,0,-1);
Ten
Copy link to clipboard
Copied
transform > reflect objects in illustrator via javascript
----------------------------------------------------------
[ edited by pixxxelschubser ] --> link updated
transform > reflect objects in illustrator via javascript
Copy link to clipboard
Copied
Hi,
There's a script created by our friend Gustavo Del Vechio (Reflex 1.0), he made a tool for that, follow your site:
Scripts (English) | Núcleo do Illustrator
Thanks again Gustavo!
Copy link to clipboard
Copied
No reason for this comment other than to point that, it contains legends of our industry (not talking about myself of course)
Copy link to clipboard
Copied
var totalMatrix = app.getScaleMatrix(-100, 100); // Cria a matriz de escala
var layer = app.activeDocument.activeLayer; // Obtém a camada ativa
for (var i = 0; i < layer.pageItems.length; i++) {
// Itera por todos os itens na camada
var currentItem = layer.pageItems[i];
// Verifica se o nome do item é "verso" antes de aplicar a matriz de escala
if (currentItem.name === "verso") {
currentItem.transform(totalMatrix);
}
}
This code works!
Copy link to clipboard
Copied
var totalMatrix = app.getScaleMatrix(-100, 100); // Cria a matriz de escala
var layer = app.activeDocument.activeLayer; // Obtém a camada ativa
for (var i = 0; i < layer.pageItems.length; i++) {
// Itera por todos os itens na camada
var currentItem = layer.pageItems[i];
// Verifica se o nome do item é "verso" antes de aplicar a matriz de escala
if (currentItem.name === "verso") {
currentItem.transform(totalMatrix);
}
}
Copy link to clipboard
Copied
var totalMatrix = app.getScaleMatrix(-100, 100); // Create the scale matrix
var layer = app.activeDocument.activeLayer; // Get the active layer
for (var i = 0; i < layer.pageItems.length; i++) {
// Iterate through all items in the layer
var currentItem = layer.pageItems[i];
// Check if the item's name is "verso" before applying the scale matrix
if (currentItem.name === "verso") {
currentItem.transform(totalMatrix);
}
}
But u got change the name of the object to "verso" and the layers to "Camada 1"