EDOBE XDOM TPC Technical Information Page 54

  • Download
  • Add to my manuals
  • Print
  • Page
    / 68
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 53
CHAPTER 5: Scripting with JavaScript Working with the perspective grid 54
Bring objects into perspective
If an art object is not in perspective, use the bringInPerspective() method to bring it into perspective
and place it on a plane.
This script creates a new document, draws art objects, and brings them into perspective on a three-point
perspective grid:
//Create a new document
var mydoc = app.documents.add();
//Draw ellipse
var myellipse = mydoc.pathItems.ellipse(60, -60, 30, 30, false, true);
//Draw polygon
var mypoly = mydoc.pathItems.polygon(-105, 105, 15, 7, false);
//Draw star
var mystar = mydoc.pathItems.star(-135, 135, 15, 10, 6, false);
//Select the default three-point perspective preset
mydoc.selectPerspectivePreset("[3P-Normal View]");
//Display the perspective grid defined in the document
mydoc.showPerspectiveGrid();
//Check if active plane is set to left; if not, set it to left
if (mydoc.getPerspectiveActivePlane() != PerspectiveGridPlaneType.LEFTPLANE)
{
mydoc.setPerspectiveActivePlane(PerspectiveGridPlaneType.LEFTPLANE);
}
//Bring the ellipse to the active plane (left plane)
myellipse.bringInPerspective(-100,-100, PerspectiveGridPlaneType.LEFTPLANE);
//Bring the polygon to the right plane
mypoly.bringInPerspective(100,-100,PerspectiveGridPlaneType.RIGHTPLANE);
//Bring the star to the floor plane
mystar.bringInPerspective(100,100,PerspectiveGridPlaneType.FLOORPLANE);
Page view 53
1 2 ... 49 50 51 52 53 54 55 56 57 58 59 ... 67 68

Comments to this Manuals

No comments