Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Rotating a pathItem with opacity mask. Mask doesn't rotate.

Participant ,
Aug 08, 2025 Aug 08, 2025

item.rotate(); rotates item but not its opacity mask. There's nothing about this in the reference afaik. Any ideas/workarounds?

-See attached video & file-

I found two similar threads but none of them really touched upon how to do this in scripting.

TOPICS
Scripting
383
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 10, 2025 Aug 10, 2025

there's a way for both extremely complicated topics

1. check if an object has an Opacity Mask

2. transform object with Opacity Mask

 

1. check for Opacity Mask as described in this post by @m1b 

https://community.adobe.com/t5/illustrator-discussions/how-to-use-getdocumentinfoastext/m-p/14206023/thread-id/386366

 

2. turn object with Opacity Mask into a Symbol, transform as usual, remove Symbol...take that chatGPT!

CarlosCanto_0-1754812018060.png

 

// rotate or move Object with Opacity Mask
// Carlos Canto - 8/10/2025

// sele
...
Translate
Adobe
Enthusiast ,
Aug 08, 2025 Aug 08, 2025

I know only one solution, and it's not the most pleasant one. This is to generate an action inside the script with the rotation angle parameter and apply it to the selected object via app.doScript(), then unload the action. This complicates scripts, so I rarely use this workaround. Unless it is critically important to consider the possible presence of an Opacity Mask in the file. Since objects don't have any Boolean properties to check for Opacity Mask, although we can check for clipped groups.

 

For example, to duplicate a print on a series of T-shirts, the designer said that he uses an Opacity Mask. Then I made an action generation inside the script with the Move command, where the calculated X, Y delta of the duplicate movement were added.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 10, 2025 Aug 10, 2025

there's a way for both extremely complicated topics

1. check if an object has an Opacity Mask

2. transform object with Opacity Mask

 

1. check for Opacity Mask as described in this post by @m1b 

https://community.adobe.com/t5/illustrator-discussions/how-to-use-getdocumentinfoastext/m-p/14206023...

 

2. turn object with Opacity Mask into a Symbol, transform as usual, remove Symbol...take that chatGPT!

CarlosCanto_0-1754812018060.png

 

// rotate or move Object with Opacity Mask
// Carlos Canto - 8/10/2025

// select a single object with Opacity Mask before running
function main() {
    var idoc = app.activeDocument;

    var sel = idoc.selection[0];

    var newSymbol = idoc.symbols.add(sel, SymbolRegistrationPoint.SYMBOLCENTERPOINT);

    instance = idoc.symbolItems.add(newSymbol);
    instance.position = sel.position;

    selection = null;

    instance.rotate(45);
    
    //instance.translate (instance.width);

    instance.breakLink(); // returns the original compound path inside a layer
    newSymbol.remove();

    var dup = selection[0];
    var parent = dup.parent; // this is the layer that needs to be removed

    dup.move (sel, ElementPlacement.PLACEBEFORE);
    parent.remove();

    sel.hidden = true; // hide for now, it could be removed if not needed

}
main()

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 10, 2025 Aug 10, 2025

Awesome, Thanks!. Adobe Scripting;  sometimes the solution’s simple, and other times people go on wild adventures just to fix something that feels like it should’ve been there all along.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 12, 2025 Aug 12, 2025

on a slight tangent but, where do you find stuff like "breakLink()" is there a list somewhere of these undocumented methods?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2025 Aug 12, 2025

breakLink() is not in the official Javascript Reference but it is sort of documented. It's in the Object Model and it also shows up in VSCode autocomplete Types-For-Adobe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 12, 2025 Aug 12, 2025
LATEST

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines