Adobe 0046100128056 Scripting Guide - Page 163
Key frames, duration and speed of the animation. For example
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 163 highlights
CHAPTER 11: Creating Dynamic Documents Working with Animation 163 //Given a page containing the ovals "myOvalA" and "myOvalB"... var myMotionPreset = app.motionPresets.item("move-right-grow"); myOvalA.animationSettings.duration = 2; myOvalA.animationSettings.playsLoop = true; myOvalA.animationSettings.preset = myMotionPreset; myOvalA.animationSettings.designOption = DesignOptions.fromCurrentAppearance; myOvalB.animationSettings.duration = 2; myOvalB.animationSettings.playsLoop = true; myOvalB.animationSettings.preset = myMotionPreset; myOvalB.animationSettings.designOption = DesignOptions.toCurrentAppearance; Key frames Key frames are points in the timeline of an animation. With InDesign scripting, you can add key frames at any time in the animation, which gives you the ability to apply changes to objects as they are animated. Key frames are part of the motion path applied to an animated page item, and are specified relative to the duration and speed of the animation. For example, for an animation with a duration of two seconds, playing at 24 frames per second, the last frame in the animation is frame 48. The following script fragment shows how to add key frames to a motion path, and how to change the transformations applied to an animated page item at each key frame. For the complete script, refer to TransformAnimation. //Given a page containing ovals "myOvalA," "myOvalB," and "myOvalC"... //The motion path is constructed relative to the center of the object, and key frames //are based on the duration of the animation divided by the number of frames per second //(usually 24). The following array sets key frames at the start, midpoint, and end //of a path. var myMotionPath = [[0,[[0,0], [0,0], [0,0]]], [23,[[234,0], [234,0], [234,0]]], [47,[[468,0], [468,0], [468,0]]]]; myOvalA.animationSettings.duration = 2; myOvalA.animationSettings.motionPath = myMotionPath; //The transformation changes at each key frame. //scaleXArray in the form [[keyframe, scale], [keyframe, scale], ...] myOvalA.animationSettings.scaleXArray = [[0, 100], [23,200], [47, 100]]; //scaleYArray in the form [[keyframe, scale], [keyframe, scale], ...] myOvalA.animationSettings.scaleYArray = [[0, 100], [23,200], [47, 100]]; //opacityArray in the form [[keyframe, opacity], [keyframe, opacity],...]; myOvalA.animationSettings.opacityArray = [[0, 100], [23, 20], [47, 100]]; myOvalA.animationSettings.playsLoop = true; myOvalB.animationSettings.duration = 2; myOvalB.animationSettings.motionPath = myMotionPath; myOvalB.animationSettings.scaleXArray = [[0, 200], [23,300], [47, 50]]; myOvalB.animationSettings.scaleYArray = [[0, 200], [23,300], [47, 50]]; myOvalB.animationSettings.opacityArray = [[0, 10], [23, 80], [47, 60]]; myOvalB.animationSettings.playsLoop = true; myOvalC.animationSettings.duration = 2; myOvalC.animationSettings.motionPath = myMotionPath; myOvalC.animationSettings.scaleXArray = [[0, 50], [23,200], [47, 400]]; myOvalC.animationSettings.scaleYArray = [[0, 50], [23,200], [47, 400]]; myOvalC.animationSettings.opacityArray = [[0, 100], [23, 40], [47, 80]]; myOvalC.animationSettings.playsLoop = true;