Adobe 0046100128056 Scripting Guide - Page 69
Transforming again, Resize and Reframe
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 69 highlights
CHAPTER 5: Working with Page Items Resize and Reframe 69 Transforming again Just as you can apply a transformation or sequence of transformations again in the user interface, you can do so using scripting. There are four methods for applying transformations again: X transformAgain X transformAgainIndividually X transformSequenceAgain X transformSequenceAgainIndividually The following script fragment shows how to use transformAgain. (For the complete script, see TransformAgain.) var myRectangle = myPage.rectangles.item(0); var myBounds = myRectangle.geometricBounds; var myX1 = myBounds[1]; var myY1 = myBounds[0]; var myRectangleA = myPage.rectangles.add({geometricBounds:[myY1-12, myX1-12, myY1+12, myX1+12]}); var myTransformationMatrix = app.transformationMatrices.add({counterclockwiseRotationAngle:45}); myRectangleA.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.centerAnchor, myTransformationMatrix); var myRectangleB = myRectangleA.duplicate(); myRectangleB.transform(CoordinateSpaces.pasteboardCoordinates, [[0,0], AnchorPoint.topLeftAnchor], myTransformationMatrix, undefined, true); var myRectangleC = myRectangleB.duplicate(); myRectangleC.transformAgain(); var myRectangleD = myRectangleC.duplicate(); myRectangleD.transformAgain(); var myRectangleE = myRectangleD.duplicate(); myRectangleE.transformAgain(); var myRectangleF = myRectangleE.duplicate(); myRectangleF.transformAgain(); var myRectangleG = myRectangleF.duplicate(); myRectangleG.transformAgain(); var myRectangleH = myRectangleG.duplicate(); myRectangleH.transformAgain(); myRectangleB.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.centerAnchor, myTransformationMatrix); myRectangleD.transformAgain(); myRectangleF.transformAgain(); myRectangleH.transformAgain(); Resize and Reframe In addition to scaling page items using the transform method, you can also change the size of the shape using two other methods: resize and reframe. These methods change the location of the path points of the page item without scaling the content or stroke weight of the page item. The following script fragment shows how to use the resize method. For the complete script, see Resize. //Given a reference to a rectangle "myRectangle"... var myDuplicate = myRectangle.duplicate(); myDuplicate.resize(CoordinateSpaces.innerCoordinates, AnchorPoint.centerAnchor, ResizeMethods.multiplyingCurrentDimensionsBy, [2, 2]);