Animation Customization via IDML
Oh no! Not another animation post from Mike! Yep, but this is a good one. It shows how you can do a whole lot more with InDesign?s animation features by...

I’m slightly hesitant to write yet another post about CS5’s animation features that possibly nobody cares about, but I’ll risk it. This discovery was just too cool (IMHO) to keep under wraps. And we’ve all agreed not to speak of the purple bike again, right? Cool.
The gist here is that if you’re willing to work in a little IDML code, you can have greater flexibility and create a much wider range of animation effects than you can by working just in InDesign.
To illustrate, let’s look at the Fade Out animation preset. Literally. Apply it to an object and look at it. See how it makes an object completely disappear? Fair enough. It is called Fade Out. But what if you wanted to partially fade an object? Like from 100% opacity to 50% opacity. How do you order a half caf Fade Out? In the Animation panel your only choices for opacity are None, Fade In, and Fade Out. There’s no opacity slider or field in which you can set a specific amount of fade. So what can you do? Well one workaround is to have two copies of the object stacked. Have the one underneath set to 50% opacity in the Effects panel. Then apply the Fade Out animation to the object on top. If you’re totally codaphobic, you can do this and it works. But the IDML solution is more elegant, and allows you to do much more.
First create a Fade Out animation, then export the animated object as an InDesign Snippet. Snippets are made of IDML, and it’s a lot quicker to find the relevant code in a snippet than it is in a full IDML archive.
Open the snippet with your favorite XML (or plain text) editor and locate the AnimationSetting element.
The AnimationSetting element has a number of properties: a Preset, a MotionPath, and a number of arrays that determine how the opacity, rotation, and scale of the object change over time. Each array contains one or more AnimationDataKeyFrameType element. These are your keyframes. They establish the value of a property at a specific point in time. MotionPath keyframes are a little different. They create motion by associating PathPoints with keyframes, basically telling the object where it has to be at a certain point in time.
The ability to insert keyframes isn’t directly exposed in the InDesign UI. But we fearless IDML explorers don’t need no stinkin’ UI! By going directly into the code and inserting additional keyframe elements and/or changing their values, you can customize animations to your heart’s content. It’s not as quick and tidy as clicking a button in a dialog box, and you don’t get the immediate gratification of a preview, but it’s pretty painless, and you earn extra geek points.
If you look at the OpacityArray in this example, you see that at keyframe 0 (the start of the animation) the opacity is 100(%). Then at keyframe 23 (the end of the animation) the opacity is 0(%). Any guesses about how you could fade to 50% opacity? Change the value in the last keyframe to 50.
Simple enough? Yes, but there is another thing you have to check and possibly change in the code. There is an attribute of the AnimationSetting element called HasCustomSettings.
If you make changes to the default values of a preset in the Animation dialog box, HasCustomSettings will be true. If you do not make any changes, HasCustomSettings will be false. The value of HasCustomSettings must be true in order for your IDML edits to hold when you place the snippet back in InDesign. Otherwise InDesign will ignore your keyframe tweaks and apply the unaltered preset animation. So if the current value of HasCustomSettings is false, change it to true and you’re in business. Save the changes to the XML and you’re done working in the code.
Place the Snippet into your InDesign document. But before you preview the results of your hand-coded awesomeness, there’s one more thing to do. Check the Animation panel to see the value of Event(s). If it was set to On Page Load before you exported the snippet, it will probably say Choose.
If that’s the case, just choose On Page Load from the pop-up menu.
I’m not exactly sure why InDesign develops a case of amnesia about this particular event. The other events, On Page Click, On Click (Self), and On Roll Over all spawn TimingSetting elements in IDML that hold the event.
In any case, it’s an easy fix.
With this technique in mind, you can experiment by adding keyframes and changing their values to create new animation effects impossible to create solely in InDesign’s UI.
This article was last modified on December 20, 2021
This article was first published on January 13, 2011
Good Lord! I don’t have the time or patience to go through every version of ID since 2011 to find out when this changed, but why oh why oh why would someone go in to change the code for such a thing???
Wouldn’t you think that the export of the attributes for a snippet would have stayed the same for animations since nothing was ever done to/from animations since they were put into ID CS5.
Hmm, you’re right Sandee. It appears that in CC 2014 the TriggerEvent code is only present when you export as IDML, not a Snippet. In the IDML it appears as an attribute of the TimingList element, which is a child of the Spread. Weird. I’d need to do some more testing, but hopefully this doesn’t mean the trigger is no longer accessible via a snippet.
Now that FXL supports ID animations, all this has become highly relevant. Perhaps even more so than when it was SWF-only.
One thing I can’t find is the TriggerEvent= setting in the XML snippet code. What am I missing?
Thanks James — that does sound reasonable, and it does make InDesign animation seem genuinely worthwhile.
I will add “animation” to my list of things it is useful to “get an initial version of” in InDesign, especially if you have InDesign open most of the day anyway.
@Jeremy,
It is a valid question. Honestly, in my option it is true that you should not be making banner ads inside InDesign and then export directly to SWF due to the file size.
That is not to say that it is pointless to use InDesign with animation.You can begin the design of a banner ad inside InDesign and create all of the art and animation. Next export it to a .fla and open it in Flash Pro. You will have to use ActionScript to create all of the timing and interactivity, but this (and changing the art to symbols whenever possible) will let you create a much smaller SWF.
Naive question: Can InDesign help to create animations that can realistically be used online?
I ask because somewhere or other I got the vague impression the SWFs it creates are too large for online use. Is that true?
Even if it is true, can these files be “tweaked” in IDML, or in Flash, to get something that can realistically be used online?
Good post again Mike!
Their is a lot of custom animations you can do if you create your animation in Flash and import them the in InDesign. Remember Animation Presets from Flash can be export/import in InDesign. A lot of fancy possibility also in this direction.
Thanks for writing this up Mike. I think Fritz has mentioned this before in a previous post, but if anyone is interested on seeing what is possible for animation via scripting/IDML-editing, check out the “Animation Encyclopedia” sample script in the CS5 Scripts panel.
The team was sooo close in delivering a “Timeline” panel in CS5 that would have provided the UI to allow you to create animations like Mike has described here directly by setting keyframes and changing the attribute values. But alas, it had to be cut, as it really was a stretch goal for the release.
That said, all the underlying work in the model is in place, as Mike’s post here proves. Any third-party developer familiar with creating ID panels could theoretically create a Timeline panel for CS5. Just sayin…
There’s a lot about the interactive features that’s accessible only through scripting (and by extension IDML)…
@Theun: Yup…
@Harbs: It should be possible to change “AnimationSettings.opacityArray” through scripting, ¿no?
It seems from the description to be a simple array of keyframe, opacity value pairs.
@Mike: Yeah. If only… :p
Yeah, I think the framework is there for a lot more functionality, but to not blow our minds (and the development schedule and budget) the folks in Seattle kept the training wheels on the animation features for CS5. Oops, there I go again with a bike metaphor ;)
Sweet, sweet geekilicious tip! All sorts of fun stuff hiding there in animation snippets I’m guessing!
Great idea! If only we knew any scripters or developers? ;)
Excellent find.
Hopefully someone will be able to harness this power via a script or plugin to give it a UI so that us mere mortals can use these features.