Adobe 0046100128056 Scripting Guide - Page 158
Working with Animation, Basic animation, TimingSettings
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 158 highlights
CHAPTER 11: Creating Dynamic Documents Working with Animation 158 var myButton = myPage.buttons.add({geometricBounds:[72, 72, 144, 144]}); myRolloverState = myButton.states.add(); var myRolloverRectangle = myRolloverState.rectangles.add({geometricBounds:[72, 72, 144, 144]}); var myFillTransparencySettings = myRolloverRectangle.strokeTransparencySettings; myFillTransparencySettings.dropShadowSettings.mode = ShadowMode.drop; myFillTransparencySettings.dropShadowSettings.angle = 90; myFillTransparencySettings.dropShadowSettings.xOffset = 0; myFillTransparencySettings.dropShadowSettings.yOffset = 0; myFillTransparencySettings.dropShadowSettings.size = 6; var myClickState = myButton.states.add(); var myNextStateBehavior = myButton.gotoNextStateBehaviors.add({associatedMultiStateObject:myMSO, behaviorEvent:BehaviorEvents.mouseDown, enableBehavior:true, loopsToNextOrPrevious:true}); Working with Animation Page items can be animated, adding motion to the dynamic documents you create using InDesign. You apply animation to objects using motion presets, define the movement of animated objects using motion paths, and control the duration of the animation using timing settings, timing lists, and timing groups. The animationSettings of an object control the animation that will be applied to the object. When animation settings have been applied to an object, InDesign sets the hasCustomSettings property of the object to true; if the object is not to be animated, this property is false. The point at which an animation begins to play, relative to the event that triggers the animation, is controlled by the objects and properties of the timingSettings object attached to the page item or to one of its parent containers (usually the spread). Basic animation The following script fragment shows how to create a simple animation (for the complete script, refer to SimpleAnimation). The most basic forms of animation can be applied without using timing settings. //Given a document "myDocument" and a page "myPage" and a color "myColorA"... //Add a page items to animate. var myPolygon = myPage.polygons.add({fillColor:myColorA, strokeColor:myDocument.swatches.item("None")}); myPolygon.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. We havent' set a dynamic trigger //for the animation, so the polygon's animation will be triggered by //DynamicTriggerEvents.onPageLoad (the default). myPolygon.animationSettings.duration = 2; myPolygon.animationSettings.motionPathPoints = myMotionPathPoints; TimingSettings The timingSettings objects of spreads, pages, and page items control the timing of the animation(s) applied to the object and to any objects contained by the object. timingSettings contain: