EDOBE XDOM TPC Technical Information Page 51

  • Download
  • Add to my manuals
  • Print
  • Page
    / 68
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 50
CHAPTER 5: Scripting with JavaScript Working with the perspective grid 51
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:
X The top of the rectangle is 2 inches (144 points) from the bottom edge of the page.
X The left edge is 2 inches (144 points) from the left edge of the page.
X 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:
X 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.
X The length of the radius from the center point to each corner is 1 inch (72 points).
X The polygon has 7 sides.
Working with the perspective grid
The Perspective Grid is a new feature in Illustrator CS5 that enables you to create and manipulate art in a
spatial environment using established laws of perspective. Enable the Perspective Grid using the View >
Perspective Grid menu or the perspective tools in the toolbar.
The SDK provides an API for working with the perspective grid programmatically, and your scripts have
some access to this API. A script can:
X Set a the default grid parameters using preset values.
X Show or hide the grid.
X Set the active plane.
X Draw an object in perspective on the active plane.
X Bring an object into perspective.
Page view 50
1 2 ... 46 47 48 49 50 51 52 53 54 55 56 ... 67 68

Comments to this Manuals

No comments