Automating Adobe InDesign CC


Adobe Fixed Layout EPUB Animation

Tuesday, May 12, 2015

Animation Presets

All of the animations demonstrated in this blog series to date have been created by setting the animation settings for objects defined on a spread using a script. What has been purposely avoided is the mention that InDesign provides a number of animation presets that can be used to set animations manually or as part of a script.

For a script, animation presets are referenced within the application's context. For AppleScript, the code would be written as follows:

   tell application "Adobe InDesign CC 2014"
      set spinPreset to Motion Preset "Spin"
   end tell 

To apply the animation preset to an object, you simply set the object’s preset property to the preset's reference.

Animate With Preset

   tell application "Adobe InDesign CC 2014"
	set spinPreset to Motion Preset "Spin"
	set selList to selection
	set item1 to item 1 of selList
	tell animation settings of item1
		set preset to spinPreset
	end tell
	get properties of animation settings of item1
   end tell

You can view the item's animation setting properties in the Result panel of AppleScript's editor when you run the above script with the page item selected.

As you can see in the screen capture above, the Spin Motion Preset sets the item’s rotation array to {{0,0.0}, {23, 360.0}} with all other animation settings given default values.

Try It

Create an InDesign document for web intent measuring 800 by 600 pixels. On the first page, create a colorful page item. With the item selected, run the script above. When you view the animation in the EPUB Interactivity Preview panel, the animation will begin as soon as you click the Play preview button. This is the default behavior as the timing list setting for the spread's timing settings is set to On Page Load.

If the timing settings for the spread had been set to On Page Click, only those animations that are part of its timing groups would be animated.

To see this behavior, add the following just before the final end tell statement in the Animate With Preset script above.

--Create On Page Click behavior
      set spreadRef to spread 1 of document 1
      tell timing settings of spreadRef
         delete timing list 1
         set pageClickList to make timing list with properties {trigger event:on page click}
      end tell

With the page item selected, run the script and preview the animation in the EPUB Interactivity Preview panel (option+shift+return).

On Page Click

When you run the script with the code above added, the EPUB Interactivity Preview shows that the animation does not activate even when the page is clicked. To have the animation for the page item trigger when the page is clicked, you need to add the page item to a timing group that is part of pageClickList

.

Add the following after the code added in the step above.

   tell pageClickList
      set pageClickGroup to make timing group with properties {dynamic target: item1, delay seconds:0}
   end tell

Now when you run the script with the page item selected, the animation triggers when previewed in the EPUB Interactivity Preview panel.

Trigger Animation When Page Item is Clicked

To add more interactivity to a spread, you can set page items to activate when the item itself is clicked. For this, a timing list is created for the page item's timing settings property. The trigger event for this is on self click.

To test this out, add a second page item to the page. Modify your script above to read as follows:

   tell application "Adobe InDesign CC 2014"
	set spinPreset to Motion Preset "Spin"
	set dancePreset to Motion Preset "Dance"
	set selList to selection
	set item1 to item 1 of selList
	set item2 to item 2 of selList
	tell animation settings of item1
		set preset to spinPreset
	end tell
	tell animation settings of item2
		set preset to dancePreset
	end tell
	--Create On Page Click behavior
	set spreadRef to spread 1 of document 1
	tell timing settings of spreadRef
		delete timing list 1
		set pageClickList to make timing list with properties {trigger event:on page click}
	end tell
	tell pageClickList
		set pageClickGroup to make timing group with properties {dynamic target:item1, delay seconds:0}
	end tell
	--Create On Self Click behavior
	tell timing settings of item2
		set item2List to make timing list with properties {trigger event:on self click}
	end tell
   end tell 

Alternatively, you can set the trigger event for a page item to on self rollover.

On Your Own

Modify the code above to add a third item to your page and set its animation to the Grow Animation Preset. Set the trigger event of its timing settings to on self rollover.

Experiment with other page items and animation presets.To see a list of all of the animation presets available, choose Interactive from InDesign’s Window menu. In the flyout menu, select Animation. From the Animation Panels menu, select Manage Presets

On Page Load and On Page Click

Of course you can have a timing list that triggers when the page is loaded and one that triggers when the page is clicked. This way, you can have page items that animate as needed: when the page is loaded, when the page is clicked, and when a page item itself is clicked.

Onward and Upward

As handy as animation presets are, when it comes to more complex animations, you have ultimate power at your bidding simply because you can write a simple script to do what you want to happen when you want it to happen. But then, when you can use an animation preset to your advantage, by all means, add its capability to your script.

Next time: Working With Buttons.

Trackback Link
http://www.yourscriptdoctor.com/BlogRetrieve.aspx?BlogID=16932&PostID=1409590&A=Trackback
Trackbacks
Post has no trackbacks.

Recent Posts


Tags

CSS HTML Export Placing images Multi-state objects Photoshop Adobe InCopy Export HTML Automated InCopy Workflow motion path lists Footnotes Typekit Custom Dialog do script Fixed Format ePub Fixed Format CSS Regions Text Variables CSS3 Shapes Keyboard Shortcuts object styles Text Cleanup Tables Buttons HTML5 Custom CSS Style Sheets date objects InDesign Libraries AppleScript Templates Script to Massage Text alternate text InCopy CC Clip-Path ePub Images stylesheets automated workflow Animation Behaviors Hyperlinks import text InCopy/InDesign Workflow document information ePub content PDF resizing images Document from Template text placement Tips and Tricks Placeholder text image metadata Caption Variable timing groups Find Object Auto Reverse on Roll Off automating InDesign Article panel InCopy text import Export for InCopy Export to SWF timing settings AppleScript say new document ePub styling ePub export find asset Templates Edge Code Rollover Animated Text Metadata Custom Style Sheets InDesign library assets Image Placement InDesign CC ExtendScript InDesign template Styling Columns Adobe InCopy CC Photoshop info CSS Shapes Create Text Frame Enabling Groups Epub Footnotes EPUB3 Export paragraph styles Document Presets table styles Fixed Layout ePub Creative Cloud InCopy Workflow InDesign assets ePub text Adding Captions Motion Presets timing lists page breaks ePub for iPad ePub for Kindle New Web ePub Check for Styles motion path points HTML Rounded Corners Automating animations automation InCopy template AppleScript dialogs images Adobe InDesign CC Create Document rotating objects Custom Buttons recursion styles Workflow automation InDesign Presentations Float with timeout giving up after Document stylesheets scripting Animating Page items

Archive