Resize has an option to specify a reference point for the transformation called scaleAbout. Transformation.DOCUMENTORIGIN to this, you can move the reference point to virtually any position in the document. var doc = app.documents[0] ;
// calculate reference point for resize
var bounds = doc.artboards[doc.artboards.getActiveArtboardIndex()].artboardRect ;
var artboardCenter = [(bounds[0] + bounds[2]) / 2, (bounds[1] + bounds[3]) / 2] ;
try {
// store original DOCUMENTORIGIN
var originalDocumentOrigin = doc.rulerOrigin ;
// set DOCUMENTORIGIN to artboard center
doc.rulerOrigin = artboardCenter ;
// resize items with Transformation.DOCUMENTORIGIN as reference point
var targetItems = doc.selection ;
for(var i = 0, len = targetItems.length ; i < len ; i++) {
targetItems[i].resize(-100, 100, true, true, true, true, false, Transformation.DOCUMENTORIGIN) ;
}
} catch(e) {
alert(e) ;
} finally {
doc.rulerOrigin = originalDocumentOrigin ;
}
... View more