Adobe 65010248 Scripting Guide - Page 47
Creating a rectangle, Creating a polygon, method to create a polygon with these properties
UPC - 883919156484
View all Adobe 65010248 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 47 highlights
CHAPTER 5: Scripting with JavaScript Creating paths and shapes 47 Creating a rectangle Consider the following sample var myDocument = app.documents.add() var artLayer = myDocument.layers.add() var rect = artLayer.pathItems.rectangle( 144, 144, 72, 216 ); The sample uses the pathItems object's rectangle() method to create a rectangle with these properties: ➤ The top of the rectangle is 2 inches (144 points) from the bottom edge of the page. ➤ The left edge is 2 inches (144 points) from the left edge of the page. ➤ The rectangle is 1 inch (72 points) wide and 3 inches (216 points) long. Creating a polygon Consider the following sample: var myDocument = app.documents.add() var artLayer = myDocument.layers.add() var poly = artLayer.pathItems.polygon( 144, 288, 72.0, 7 ); The sample uses the polygon() method to create a polygon with these properties: ➤ The center point of the object is inset is 2 inches (144 points) on the horizontal axis and 4 inches (288 points) on the vertical axis. ➤ The length of the radius from the center point to each corner is 1 inch (72 points). ➤ The polygon has 7 sides.