Your prescription for increased productivity and profitability
In our last blog post we demonstrated using an animation from Adobe Animate CC 2017 within an InDesign document. The process worked great, and for some animation projects may be the only way to go. But even with an application as powerful as Animation CC 2017, anything that involves user interaction will require writing a bit of code. And when you want to tap into the real power of the application, you will get into some serious stuff.
Aside from using Animate CC 2017, there are those projects that can have all the animation needed created within InDesign itself. Whether you know how to write code or not (we assume that you do), you should know how to set up animations in InDesign. So follow along, you will be creating animations in no time.
To start with, there are a number of animation presets that can be added to objects in InDesign: 48 to be exact. These control five basic animations: motion, speed (duration and easing), rotate (with orientation point; up to 7200 degrees), scale (up to 7200%), opacity (fade in/fade out). Most of this can be set in one simple panel: the Animation Panel.
Open the Animation Panel (Window > Interactive > Animation). What you do in this panel is pretty intuitive: Give the animation a name, choose a preset, determine when the animation is triggered (On Page Load, On Page Click, On Self Click, On Self Rollover), and set its Duration, Play, Loop and Ease (from the Speed dropdown).
. Animation Panel in InDesign
Buttons at the bottom of the animation panel are from left to right: Open Preview panel, Show animation proxy, Show Timing Panel, Convert to motion path, and Remove animation (trash can).
If you want to modify the properties for a Preset, expand the Properties portion of the Animation panel to set values for rotation, scale, opacity and visibility. And, when you get familiar with how this all works, you can add Timing from the Timing panel.
Since you know how to write scripts, you may find that this is where the real power for animating InDesign is found. With a script you can take advantage of having the presets as well as being able to add capability not available from the user interface. When you decide you want to try your hand at scripting animations in InDesign, you will want to spend some time with a script provided for you as part of Adobe’s Sample Scripts: Animation Encyclopedia.
Open the Script panel (Window > Utilities > Scripts). There is a collection of scripts written in AppleScript and one in JavaScript. (On Windows you will have a VisualBasic collection instead of AppleScript.) To run the Animation Encyclopedia script, double-click on its entry in the script list.
To understand what is going on under the hood, you will want to open the script and follow along. To open the script, right-click (Control-click) on the script entry and select Edit Script.
The script starts by creating a 6-page document.
The code for this page defines a simple motion path that starts at the object’s current location and moves horizontally by 565 points.
set myMotionPath to {{{{0,0}, {0,0}, {0,0}}, {{565, 0}, {565, 0}, {565,0}}}, true}
Notice that the path is a list of three values representing x,y coordinates. The three values represent the anchor point, plus two control handles for a Bezier curve. Since there is no curve involved, all three values are the same.
Four of the examples for this page demonstrate basic animation properties:
set motion path points to myMotionPath
set motion path to myMotionPath set rotation array to {{0,0}, {23, 270}}
set motion path points to myMotionPath set opacity array to {{0, 100}, {23, 10}}
set motion path points to myMotionPath set scale x array to {{0, 100}, {23, 20}} set scale y array to {{0, 100}, {23, 20}}
The remaining three examples, using a combination of properties, take a little more explanation.
set motion path points to myMotionPath set scale x array to {{0,100}, {23,20}} set scale y array to {{0,100}, {23,20}} set rotation array to {{0,100}, {23,-270}} set opacity array to {{0,100}, {23,25}}
Notice that rotation for this object goes from {0,0} to {23, -270}; the negative rotation value indicates counter-clockwise rotation.
set myMotionPath to {{{{0,0}, {0,0}, {0,}}, {{565,0}, {565, -150}, {565,0}}}, true}
To change the trigger event for the spread animations from the default (On Page Load) to On Page Click, the default timing list is deleted:
delete timing list 1
A timing group click list is then created, setting the dynamic target for items in the list to each successive rectangle on the page with a delay of 0 seconds:
set p1TimingOnPageClickList to make timing list with properties {trigger event: on page click} tell p1TimingOnPageClickList set p1timingGroup1 to make timing group with properties {dynamic target: myRectangle1, delay seconds:0} ...
This is done for all rectangles with the exception of rectangles 6 and 7 which are grouped. First a timing group is created with myRectangle6 as the dynamic target. And then myRectangle7 is added as a timing target to the group:
set p1timingGroup6 to make timing group with properties {dynamic target: myRectangle6, delay seconds:0} tell p1timingGroup6 make timing target with properties {dynamic target: myRectangle7, delay seconds:0} end tell
Where the animations for Page 1 are set to fire sequentially when the page is clicked, the animations for Page 2 demonstrate On Page Click, On Self Click, On Self Rollover, On Button Click, and Go to Next State for a Multi-State Object. Interestingly, all of the objects use the motion preset “twirl.”
set motionPreset to Motion Preset "twirl" set myRectangle1P2 to myMakeRectangle ¬ (page 2, {1.625, 1, 2, 2}, "On Page Load Rectangle", "Purple", "None", 0) tell animation settings of myRectangle1P2 set preset to myMotionPreset end tell
Determining the event to target each animation adds a little more complexity to the animation settings for the spread. First, the default timing list for the spread is removed, and then timing list objects are created, one for On Page Load and one for On Page Click. The timing lists then include timing groups that target the page objects and specify delays.
set myPageTwoTimingSettings to timing settings of spread 2 tell myPageTwoTimingSettings delete timing list 1 --for Page Load set mySecondPageLoadTimingList to make timing list with properties¬ {trigger event:on page load} tell mySecondPageLoadTimingList set secondSpreadTimingG1 to make timing group with properties¬ {dynamic target:myRectangle1P2, delay seconds:0} end tell --for Page Click set mySecondPageClickTimingList to make timing list with properties¬ {trigger event:on page click} tell mySecondPageClickTimingList set secondSpreadTimingG2 to make timing group with properties¬ {dynamic target:myRectangle2P2, delay seconds:0} end tell --timing settings for Self Click and Self Roll Over are set for the page object within the spread’s timing settings tell timing settings of myRectangle3P2 set myRectangle3P2TimingList to make timing list with properties¬ {trigger event:on self click} end tell end tell --end spread’s timing settings
We will look at the details for working with buttons and Multi-State Objects in next week’s blog. Imagine, all of this is only for Page 2. With four more pages of examples, you can see, there is a lot of information that can be gleaned from this one sample script.