Copy link to clipboard
Copied
Getting this error when trying to `applyEffect` free distort
var effectString =
'<LiveEffect name="Adobe FreeDistort"><Dict data="DistortTopLeftX 0 DistortTopLeftY 0 DistortTopRightX 50 DistortTopRightY -20 DistortBottomLeftX -10 DistortBottomLeftY 70 DistortBottomRightX 60 DistortBottomRightY 50"/></LiveEffect>';
item.applyEffect(effectString);
The problem seems to be caused by the application of the live effect, as the code worked with a simple effect applied, and I'm applying it to a simple PathItem.
While searching it seems like the error is a vague one, so any help would be appreciated
/**
* @File Free Distort Sample
* https://community.adobe.com/t5/illustrator-discussions/illustrator-error-occurred-1346458189-mrap/td-p/15079479
* @Version 1.0.0
* @author sttk3.com
*/
(function() {
if(app.documents.length <= 0) {return ;}
var doc = app.documents[0] ;
var sel = doc.selection ;
if(sel.length <= 0) {r
...
Copy link to clipboard
Copied
/**
* @File Free Distort Sample
* https://community.adobe.com/t5/illustrator-discussions/illustrator-error-occurred-1346458189-mrap/td-p/15079479
* @Version 1.0.0
* @author sttk3.com
*/
(function() {
if(app.documents.length <= 0) {return ;}
var doc = app.documents[0] ;
var sel = doc.selection ;
if(sel.length <= 0) {return ;}
var topLeft = [0, 0] ;
var topRight = [5, -2] ;
var bottomLeft = [-1, 7] ;
var bottomRight = [6, 5] ;
var effectString = '<LiveEffect name="Adobe Free Distort"><Dict data="R src0h 0 R src0v 0 R src1h 1 R src1v 0 R src2h 0 R src2v -1 R src3h 1 R src3v -1 R dst0h ' + topLeft[0] + ' R dst0v ' + topLeft[1] + ' R dst1h ' + topRight[0] + ' R dst1v ' + topRight[1] + ' R dst2h ' + bottomLeft[0] + ' R dst2v ' + bottomLeft[1] + ' R dst3h ' + bottomRight[0] + ' R dst3v ' + bottomRight[1] + ' "/></LiveEffect>' ;
var targetItem = sel[0] ;
targetItem.applyEffect(effectString) ;
})() ;
Copy link to clipboard
Copied
Thank you 🙏 this worked