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

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

Archive