How do I apply a warp effect to an object from an Illustrator script (JavaScript)?
There's two ways to go about this:
Already have an existing graphic style that you can apply to an item. (https://forums.adobe.com/message/4380742#4380742#4380742) The example from Muppet Mark reads:
var doc = app.activeDocument;
var fuzz = doc.graphicStyles.getByName( 'fuzz' );
fuzz.applyTo( doc.pageItems[0] );The more complicated method is to use the live-effect XML string, a special command syntax for Illustrator scripting that has only been revealed to us in the last couple of years. For complex graphic styles or effects it still may take a lot of work to even determine what the correct string is because this feature is completely undocumented. For your warp needs, this should suffice though. See this link here (https://forums.adobe.com/message/9356527#9356527)
#target illustrator
function test(){
var doc = app.activeDocument;
var p = doc.selection[0];
var effectStr_2 = '<LiveEffect name="Adobe Deform"><Dict data="R DeformValue 0.45 R DeformVert 0 B Rotate 0 I DeformStyle 1 R DeformHoriz 0 "/></LiveEffect>';
p.applyEffect(effectStr_2);
};
test();
-
1
-
-
1