EasyManua.ls Logo

Adobe 0046100128056 - InDesign - Mac - Motion Presets; Design Options

Adobe 0046100128056 - InDesign - Mac
209 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
CHAPTER 11: Creating Dynamic Documents Working with Animation 162
//Given a document "myDocument" and a page "myPage" and the color "myColorA"...
//Add a page items to animate.
var myPolygonA = myPage.polygons.add({fillColor:myColorA,
strokeColor:myDocument.swatches.item("None")});
myPolygonA.paths.item(0).entirePath = [[72, 72], [72, 144], [144, 108]];
//Create a motion path.
var myMotionPathPoints = [[[[108,108],[108,108],[108,108]],[[516, 108],[516,
108],[516, 108]]],true];
//Set animation preferences for the polygon.
myPolygonA.animationSettings.duration = 2;
myPolygonA.animationSettings.motionPathPoints = myMotionPathPoints;
//Assuming 24 Frames Per Second (FPS)
//23 = 1 second, 47 = 2 seconds, 71 = 3 seconds, 95 = 4 seconds, 119 = 5 seconds, 143 = 6
seconds
//Since the duration of our animation is 2 seconds, the following line will
//make the polygon rotate 360 degrees from the start to the end
//of the animation.
myPolygonA.animationSettings.rotationArray = [[0, 0], [47, 360]];
var myTimingSettings = myPage.parent.timingSettings;
//Remove the default timing list.
myTimingSettings.timingLists.item(0).remove();
//Add a new timing list that triggers when the page is clicked.
var myTimingList = myTimingSettings.timingLists.add(DynamicTriggerEvents.onPageClick);
//Add the polygons to a single timing group.
var myTimingGroup = myTimingList.timingGroups.add(myPolygonA, 0);
Scripting offers more control over animation than can be achieved with InDesigns user interface. A
scripted animation can, for example, apply transformations at each key frame of a given motion path. For
more on this topic, see “Key frames”
later in this chapter.
Motion presets
In the preceding examples, we’ve constructed motion paths and specified animation settings as if we were
creating animations from the basic level in InDesigns user interface. But InDesign can also use motion
presets to define the animation of page items in a layout. A motion preset can apply a number of
animation properties at once, as seen in the following script fragment (for the complete script, refer to
MotionPreset). InDesign comes with a large number of motion presets, and you can add new presets using
either the user interface or scripting.
//Given a page containing the ovals "myOvalA"...
var myMotionPreset = app.motionPresets.item("move-right-grow");
myOvalA.animationSettings.duration = 2;
myOvalA.animationSettings.playsLoop = true;
myOvalA.animationSettings.preset = myMotionPreset;
Design options
Design options affect the way that an animated object appears, relative to the motion specified in the
objects animation settings. The following script fragment shows how the design options for an animated
shape can affect the playback of the animation (for the complete script, refer to DesignOptions).

Table of Contents

Related product manuals