Mobile app version of vmapp.org
Login or Join
Miguel516

: Illustrator Script to create Clipping Mask How is it possible to create a clipping mask with a illustrator javascript script? I tried this, but it doesnt work. var group = app.activeDocument.groupItems.add();

@Miguel516

Posted in: #AdobeIllustrator #Javascript

How is it possible to create a clipping mask with a illustrator javascript script?

I tried this, but it doesnt work.

var group = app.activeDocument.groupItems.add();

var rect = layer.pathItems.rectangle( height, 0.0, width, height );
rect.moveToBeginning( group );

var ellipse = layer.pathItems.ellipse(ellipseLeft, ellipseTop, ellipseWidth, ellipseWidth);
ellipse.clipping = true;
ellipse.moveToBeginning( group );


What i need is a working code sample

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Miguel516

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi706

You need to set the group to be clipped too (after adding your paths). I believe setting the ellipse to be the clipping mask is unnecessary if it is the last object you add (the top object in the group should become the clipping path if you don't specify).

var group = app.activeDocument.groupItems.add();

var rect = layer.pathItems.rectangle( height, 0.0, width, height );
rect.moveToBeginning( group );

var ellipse = layer.pathItems.ellipse(ellipseLeft, ellipseTop, ellipseWidth, ellipseWidth);
ellipse.clipping = true;
ellipse.moveToBeginning( group );

group.clipped = true; // <-- Add this after adding your paths to the group.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme