Join Keith Gilbert for an in-depth discussion in this video Control the animation with buttons, part of InDesign: Fixed-Layout EPUB Interactive Techniques & Publish Online.
- Instead of having the billboard automatically scroll to the left when the page is viewed as we learned in the previous movie, we want to give the user the ability to start and stop the scrolling whenever they want and to control the direction as well. We can do this by adding some buttons to our InDesign file. In the Exercise Files folder, open up 05_02_panorama_begin I've placed six buttons on the page for you and you might wonder, why six? Well, we need buttons for play forward, play reverse, pause forward, pause reverse, resume forward and resume reverse.
We'll understand a little bit more how that works as we go through this. To make things easier, I've spread the buttons out on the page for you. It's easier to edit them if they aren't stacked on top of each other. When we're almost finished, we'll stack and align the buttons as the final step. I've already turned the artwork into buttons for you and given each button a name but I have not yet assigned an action to any of the buttons. So all I did was create some static artwork, turn it into a button and name it. Before we begin working with the buttons, the first thing we want to do is select the panorama or the billboard image and over in the animation panel, we want to remove the On Page Load event.
So we don't want it to start to scroll when the page loads. Now we're going to go in and edit some of these buttons. We're going to assign an action to each of these six buttons to start with. So the play forward button, we want to set that up so that the action controls the animation and simply plays it. The play reverse button should also control the animation but should play in reverse. The pause forward button should simply pause the animation as should the pause reverse button.
The resume forward button should resume the animation as should the resume reverse button. Once you've got all six wired up, go ahead and preview what you've done so far. We can now play the animation forward and back. We can pause it. We can resume it. So it all works as expected at this point but we want to be able to hide the buttons that aren't relevant at a particular point in time.
For example, the play button should be hidden when the animation is paused and the resume button should be displayed instead. Let's see how to do that. To begin with, select the bottom four buttons by Shift clicking on them and in the Buttons and Forms panel, select this Hidden Until Triggered option. That will cause those four buttons to be hidden until we tell it to display them. Then select the play forward button. We want to add the Show/Hide Buttons and Forms action and now we need to tell it which buttons we want to show and which buttons we want to hide and we want to show the play reverse button and we want to show the pause forward button and then we want to hide all the other buttons in this case.
So you can double click on the little x to hide the button. Then select the play reverse button and add the Show/Hide Buttons and Forms action to that and for this button we want to show play forward, show pause reverse and hide all the rest of the buttons. Then for the pause forward button, we want to again add the Show/Hide Buttons and Forms action and we want to hide pause forward and show resume forward and then the other four buttons we can leave their status unchanged so just leave an x in that column.
For the pause reverse button, again add the Show/Hide Buttons and Forms action and then we want to hide the pause reverse button and we want to show the resume reverse button and then leave the other four unchanged. Two more left. Select the resume forward button, add the Show/Hide Buttons and Forms action and show the pause forward button and hide the resume forward button and leave the other four unchanged.
And finally, the resume reverse button. Add the Show/Hide Buttons and Forms, show the pause reverse button, hide the resume reverse button and that does it. So now we just align the buttons. So I'm going to select the three right hand buttons, click one more time on the top button that makes that the key object and in the Align panel, I'm going to tell it to vertically align their centers and repeat the process for the left hand buttons and let's preview that and see if it works.
So now when we click on the play button, it should change to a pause button and it starts to play the animation. If we click the pause button again, it pauses and gives us the play button back. Actually, it looks like the play button but it's actually the resume button so that you can pause and resume all that you want. You can back up and go to the reverse play button. Do the same thing with that. Looks like we got it all right. Admittedly that's pretty tedious and it's kind of a brain twister but it's a really useful effect.
You've learned quite a bit here about not only how to create a useful effect but also more about how to control animations with multiple buttons.
- Creating animated navigation buttons
- Building interactive slideshows
- Creating reveal buttons
- Adding multiple choice and branching quizzes
- Creating a scrolling panorama
- Embedding video
- Creating buttons to send email