1 / 28

Advanced Animation Techniques Part II

Advanced Animation Techniques Part II. by Demetrios Halazonetis www.dhal.com. Using Macros for Animation. First create the object you wish to move. Then write a macro that moves the object. Add a custom action button on the slide.

Télécharger la présentation

Advanced Animation Techniques Part II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced Animation TechniquesPart II by Demetrios Halazonetis www.dhal.com

  2. Using Macros for Animation • First create the object you wish to move. • Then write a macro that moves the object. • Add a custom action button on the slide. • Then set the Action Settings of the button to trigger the macro.

  3. Create the object • This is the easy part. • The object can be a simple object or a group of objects. • The next slide (Slide 4) has the object (mandible plus teeth, in a group). It also has other things on it, which will be explained later.

  4. Rotate Animation Rotate Condyle Rotate RotateReset Move ResetAll

  5. Writing a macro (good luck) • NOTE: The following is a step-by-step guide. However, the macros are already present in this file, so you should not follow these steps, unless you do it in a new PowerPoint presentation, which does not contain any macros.

  6. Writing a macro (assuming no macros are already present) • Open the Visual Basic Editor: Tools>Macro>Visual Basic Editor • In the Project box, select the VBProject and then select Insert>Module from the menu. The code window opens. If not, double-click on the newly created module (Module1).

  7. Writing a macro… • Position the mouse cursor in the code area (the large window on the right) and select Insert>Procedure. Type “SimpleRotate” and make sure Sub and Public are selected. Click OK. • In the code box, complete the procedure so it looks like the following: (next slide)

  8. A simple procedure: Public Sub SimpleRotate() Dim aSlide As Slide, aShape As Shape Set aSlide = ActivePresentation.Slides(4) Set aShape = aSlide.Shapes(1) aShape.Rotation = aShape.Rotation + 3 End Sub

  9. Writing a macro… • This procedure rotates the first shape (object) on Slide #4 by 3 degrees. • To see it in action we need to ‘attach’ it to an action object. (next slide)

  10. Create an action button • Slide 4 has an action button ‘Rotate’. This was created by selecting: Slide Show > Action Buttons > Custom • Then drag the mouse on the slide to create the button.

  11. Create an action button… • As soon as the button is created, the Action Settings dialog box opens. • Select the Run Macro option and pick the SimpleRotate macro from the list box. • The text on the button was entered after right-clicking the button and selecting Add Text from the pop-up menu.

  12. Now test it! • Go to slide #4. • Click the Slide Show icon on the lower left of your screen. • Use your mouse to click the Rotate button. The mandible and teeth should rotate each time the button is pressed.

  13. Problems • How do we translate? • How do we return the mandible to the original position?

  14. More difficult problems • Rotation is around the center of the mandible. How do we rotate around the condyle? • If we have more shapes on the slide, how do we specify (in the macro) which shape will move?

  15. Some info to solve the problems • Slides have a coordinate system from 0,0 at the upper left corner, to 720,540 at the lower right. These coordinates hold for On-screen Show (File>Page Setup…). • Macros permanently alter the placement of objects. Therefore, we require a macro to return the object to the original position. Else, use the Undo command (Edit>Undo) immediately after running the macro.

  16. More help • An example of an undo macro for the SimpleRotate macro can be found in this file. It is the SimpleRotateReset macro. The main command is this: • aShape.Rotation = 0 • The RotateReset button on Slide #4 activates this macro. So after using the Rotate button, click the RotateReset button to return the mandible to the original position.

  17. Translating objects • An example of a macro for translating objects is the SimpleMoveRightDown. Use the Move button on Slide #4 to activate it. • The SimpleResetAll macro resets the mandible to its original position.

  18. Animating movement • You can create continuous animation by repeating movements many times. The SimpleRotateAnimation demonstrates this. The main code is this: • For n = 1 To 10 • aShape.Rotation = aShape.Rotation + 3 • DoEvents • Next

  19. Animating movement… • We see that the heart of the code is the same as the SimpleRotate macro. It is just repeated 10 times. • The DoEvents command allows PowerPoint to redraw the slide after each rotation, so that a continuous motion is perceived.

  20. Specifying the slide in the macro • Slides in PowerPoint are held in a list. To specify e.g. slide #4, use a command such as this : • Set aSlide = ActivePresentation.Slides(4) • If you know the name of the slide you can also use this syntax: • Set aSlide = ActivePresentation.Slides(“Mouth”)

  21. Specifying the object in the macro • Objects in PowerPoint are held in a ‘Shapes’ list. To specify the desired object (e.g. shape #1 in slide: aSlide) use a command such as this: • Set aShape = aSlide.Shapes(1) • If you know the name of the object you can also use this syntax: • Set aShape = aSlide.Shapes(“tooth”)

  22. Rotating around any point • To rotate an object around any point, use the RotateAround macro that is included in this file. You should include it in your own macros like this: • RotateAround aSlide.Shapes(1), 3, 190, 140 • (see the RotateCondyle macro and try the Rotate Condyle button on Slide #4. Remember to use the ResetAll button to return the mandible to the original position)

  23. Helper file • PowerPoint does not have an easy way to rename objects or slides, or to figure out the coordinates of objects on a slide. • You can use the ShowShapes.ppt file to help you do this. Open the file in PowerPoint and then run the ShowSlideObjects macro (with your .ppt file open at the same time). A dialog box will open, which shows all shapes on the current slide. You can rename the slide or the shapes on it. You can also see their Top, Left and Rotation properties so that you can write macros easier.

  24. Example 1: Eruption and ankylosis Click the teeth on the left, then the teeth on the right. Click Reset to return them to the initial position. Reset

  25. Example 2: Opening and closing Open Close

  26. Example 3: Torque Click on the buttons in turn: Torque wire Insert wire Torque is expressed Reset

  27. Example 4: Activate T loop Note: the template curves could be drawn with No Line, and would be invisible. Activate Reset

  28. Good luck! • If you need help: • www.dhal.com

More Related