Join Diane Burns for an in-depth discussion in this video Customizing animations via Snippets, part of InDesign: Creating Animations.
- In this video, I'm going to show you how to extend the capabilities of InDesign's Animation panel by editing snippets. The Animation panel is great but there are certain settings we can't really adjust. For example, the opacity only goes from zero to 100% or vice versa with our Fade In and Fade Out Presets. Wouldn't it be nice if we could, for example, have something start at 100% opacity and fade out to 20% opacity so we can still see it. One way to do this is to use snippets. They're normally not used for this purpose but they will work great for us here.
Let me show how it's done. I'm gonna build in a new capability so that I can fade something out to 20% opacity. The first step is to start with an object and I'm gonna apply a Preset that's close to the one I want to create. In this case, Fade Out. Next, I'm gonna export this as a snippet. So I'll go to the File menu and Export. I need to make sure that the format is set to InDesign Snippet. And then I'm gonna this snippet a name. I like to name it with the Preset, in this case Fade Out, and START.
This tells me this is the built-in Preset. I'll save this snippet file and now I'm gonna edit it in an HTML editor. I like to use TextWrangler so let's jump over and look at this snippet file. Here's our snippet file and there's a lot of very daunting code at the beginning of it. But you can just ignore that and come down to, oh, usually about line 187 or 188. And we have something very interesting here. We have a whole bunch of animation settings. And we can actually come in here and modify the settings for opacity, rotation, and for scaling.
Both horizontally and vertically. That's pretty interesting. Before we change any of these though, we have to set this snippet so that it no longer thinks that it's a built-in Preset. At the beginning of the AnimationSetting code here, we have this listing HasCustomSettings="false". Well, we're about to give it custom settings so we're gonna double click that false and change it to true. That's step one. Now if you start out in the Animation panel with a non-built-in preset this will already be flagged to true.
But we have to change it here. Now, let's look at the opacity area here. You'll notice that in all of these settings there's something that says KeyFrame. KeyFrame is the timing and there are 24 KeyFrames to every second in InDesign animations. The first KeyFrame is numbered zero and the last KeyFrame is number 23. In this case, KeyFrame zero has a value of 100%. That's the opacity we start with. And it ends with a value of zero. That makes sense for Fade Out.
But I wanna change this to 20 so I'm just gonna come in and edit this value to 20. Now I'll save this file but I'm gonna give it a different name. I like to give it a name that sort of tells me what it does. So I'm gonna call this FadeOut-20. Now, we'll import this new snippet back into InDesign. I'm gonna use the File Place command, Cmd or Ctrl d. And we'll bring it in this new snippet.
When you re-import these snippets, there is no start event applied to them. So you do have to set this to On Page Load. But if we look in the Animation panel, we have something very interesting here. Notice the Opacity now says, "From Preset". We like that because we have this new opacity setting for fade-out. Let's preview this. There's our 100% fade-out and look at that! It only fades out to 20%. Now, that's great for this one object but what would make this really useful is if I could save it as a Preset and reuse it on other objects.
Well, you can do that. And that's what makes this capability so powerful. I'm going to select this object, my panel is all set, and then I just need to save it as a Preset. Just like I would if I made modifications in the Animation panel. I'll choose Save and I'll call this FadeOut-20 And click Ok. Now, let's give it a try. I'll click on this other object over here and let's go to our Preset menu.
In the Preset menu are some other custom Presets that we saved by making different adjustments in the Animation panel but here's the custom Preset that we made by modifying the snippet file. I'm gonna apply that and let's see what we have. Beautiful! I love that. The only limitation here is, just as when you modify Properties in the Animation panel, there are certain settings that don't stick. For example, we can't set this modified Preset to Loop or set Hide Until Animated.
But that's ok because we can do all these great other things. I'm gonna show you one more example in TextWrangler. This is a completed snippet file and here I've created an animation that will go from 0% opacity to 100% opacity and back to zero. It's gonna fade in and then fade out, all in one setting. And what I did here was, originally there were only two lines, I started with a fade-out Preset. But I came in and copied one of these lines and pasted it so I have a new line here in the middle.
And this middle KeyFrame value I usually make 12 because it's right in the middle. And now I can have these back and forth settings. I then save the snippet, import it into InDesign and make a new Preset from it. Let's go back to InDesign. These modified custom Presets are a lot of fun and in fact, I've prepared 12 different Presets for you using this technique. And they're available in a free downloads file. If you're downloading the exercise files, I've also included the original snippet file so you can see the code.
I'll show you how to load the free Presets. Go to your Animation panel and choose Manage Presets. Click on the Load button and go to the FreePresets folder. I'm gonna just select all of these, they're numbered one through 12. And they do all kinds of things. Fade-in, fade-out. We even have some that rotate in one direction and then back in the other. And we have some that do some interesting things with scaling. Just load those up. Click Done. And now, you have all these new Presets available.
I'm gonna go to the next page in this file so we can take them for a spin. Now they're listed in reverse order because this panel always lists the most recently added Preset at the bottom. So for example, I can set this light bulb to fade in and fade out. I've got another Preset that will let me rotate this baseball bat 45 degrees and then back. Or, here's one of my fav's, I can make this coin appear to flip. And I'm actually gonna Loop that setting.
Let's preview this. In and out, back and forth and the coin is flipping. Isn't that fun? You know, I'm not a code person at all but modifying snippets and saving them as Presets is so easy, even for me. And it let's you extend InDesign's animation capabilities in some really interesting ways. Give it a try.
- Setting up an animation workspace
- Working with the Animation panel
- Viewing and editing animation presets
- Working with rotation and scaling
- Creating motion paths
- Adjusting timing
- Animating type
- Animating infographics
- Adding buttons and sounds
- Building more complex animations
- Exporting animation
- Creating, saving, and sharing custom motion presets
Skill Level Intermediate
Q: This course was updated on 03/23/2016. What changed?
A: We updated the video "Supported format overview" and added a new movie, 'Using animations with Publish Online."