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

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

Archive