2

How do I apply a warp effect to an object from an Illustrator script (JavaScript)?

1 Answer 1

2

There's two ways to go about this:

  1. 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] );

  2. 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();

3
  • 1
    I got the LiveEffect approach to work. Thanks. Commented Nov 28, 2018 at 0:45
  • That's just incredible!
    – Silly-V
    Commented Nov 28, 2018 at 2:19
  • 1
    I see what you did there! Commented Dec 31, 2018 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.