October of 2014 brought good news for designers using Adobe InDesign CC. The upgrade (2014.1) fixed a number of issues and added some new features for fixed layout ePub documents.
Here are some of the improvements we have noticed:
The animation that was available for Interactive PDF in InDesign 5.5 and 6.0 is now available for ePub fixed layout. At last count there are 39 Motion Presets in InDesign CC, giving users animation options from flying a page item in from any side of the document (“Fly in from…”) to “Dance.”
These options are made available in InDesign’s Animation Panel which is accessed from the Window > Interactive menu item. Select the item you want to animate and open the panel. The panel will suggest a name for the animation. From there you choose the Animation Preset and a number of options.
These options include:
If you disclose the Properties triangle in this panel, you can set up your animation to include further refinements. To make sure your animation performs as expected, you can preview it using the Preview button at the bottom of this panel.
Animation panel with Speed options disclosed
You can automate InDesign’s built-in animations using your favorite scripting language (AppleScript or ExtendScript). These can include the motion presets or any number of custom animations you write that may include timing and multiple actions.
Just think of the number of times you might want to animate a fly in or fade in when the page is opened. The following AppleScript should open the door to writing some simple motion preset scripts. With these scripts assigned to a keyboard shortcut, the animation could be attached to a page item with just a single combination keystroke.
The script allows the user to choose from a list of motion presets. Loop is set to false with a 1 second duration. For a “fly in”, the object to be animated is placed at the page position intended when the animation concludes. With the item selected, the script is run and one of the “fly in” motion presets is chosen. The script does the rest.
--prompt to be used for choose from list method set thePrompt to "Choose preset from list" tell application "Adobe InDesign CC 2014" --get list of motion presets set theList to name of Motion Presets try --call routine to have user choose motion preset to use set presetChoice to my chooseFromList(theList, thePrompt, 1, false) set presetRef to MotionPreset presetChoice --assumes user has a page item selection set itemRef to item 1 of selection tell animation settings of itemRef set plays loop to false set duration to 1 --1 second set preset to presetRef --the option is actually "to current location"; thus two "to's" in the following statement set design option to to current location end tell on error errStr --if error condition, alert the user activate display alert errStr end try end tell (*Handler presents a choose from list dialog from which to select the preset*) on chooseFromList(choiceList, thePrompt, defaultChoice, allowMultiple) set userChoice to choose from list choiceList with prompt thePrompt default items defaultChoice multiple selections allowed allowMultiple if class of userChoice is not list then error "User cancelled" else set presetName to item 1 of userChoice end if return presetName end chooseFromList
The list of motion presets can be a little daunting when presented as a list box (choose from list). Alternatively, you could have the script display a custom dialog to present a drop down of motion preset choices for the user
You might even think in terms of having a number of custom animation scripts tucked away in a dedicated folder. The scripts in this folder would then be run using do Script. For this, another script, “Run Script,” can be used to present the list of scripts for the user to choose from. When a name is selected by the user, the script is run.
This script assumes the user has a document open with the script’s target page open. For the following, the scripts are located in a folder named “doScripts” inside InDesign’s Presets folder.
tell application "Adobe InDesign CC 2014" set appPath to file path as string --place designated folder path in a variable set scriptPath to appPath & "Presets:doScripts:" end tell --get list of file names from designated folder set fileNames to list folder scriptPath without invisibles set thePrompt to "Choose script from list" --see call to chooseFromList handler in script above set userChoice to chooseFromList (fileNames, thePrompt, 1, false) set scriptRef to scriptPath & userChoice tell application "Adobe InDesign CC 2014" do script file scriptRef end tell
You will need to add the chooseFromList handler from the script above to complete. You should also add code to make sure the user has a document open. If the script might do damage to an active page, your script should also alert the user to this potential and execute do script only after the user confirms.You may think of other refinements to the scripts, but these should get you started.
It is hoped that these two examples will whet your appetite for creating some scripts to save time and enforce consistency. Next week we will be looking at some sample code for creating custom animations. All of these will be done inside InDesign and will work when the fixed layout ePub is viewed in iBooks.