Copy link to clipboard
Copied
Hi,
i can't figure out how to simple rotate selected object with javascript. I read the 'Illustrator CS3 scripting guide' and wrote this code:
var myObject = app.activeDocument.selection;
myObject.rotate(30);
but it isn't working (Error24: myObject.rotate is not a function). Please someone tell me what am I doing wrong here.
Copy link to clipboard
Copied
Selection is an Array of objects you will probably need loop thru each object in your selection array
Copy link to clipboard
Copied
Thank you very much, you point me in the right direction. This code works for me:
var mySelection = app.activeDocument.selection;
var myObject = mySelection[0];
myObject.rotate(-2);
Copy link to clipboard
Copied
That is going to rotate the first item of your selection (OK if you only have one item selected) the other option for multi items would be to move them into new group item, rotate this (as it has a rotate method) then move items back out of group.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more