Professional Documents
Culture Documents
Rotate
RotateReset
Move ResetAll
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)
A simple procedure:
Public Sub SimpleRotate() SimpleRotate() Dim aSlide As Slide, aShape As Shape Set aSlide = ActivePresentation.Slides(4) Set aShape = aSlide.Shapes(1) aSlide.Shapes(1) aShape.Rotation = aShape.Rotation + 3 End Sub
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)
Problems
How do we translate? How do we return the mandible to the original position?
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.
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.
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
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.
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.
Reset
Click the teeth on the left, then the teeth on the right. Click Reset to return them to the initial position.
Open Close
Example 3: Torque
Activate
Reset
Note: the template curves could be drawn with No Line, and would be invisible.
Good luck!
If you need help:
www.dhal.com