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

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

Archive