Advanced Animation 2

28
Advanced Animation Techniques Advanced Animation Techniques Part II Part II  by Demetrios Halazonetis www.dhal.com

Transcript of Advanced Animation 2

Page 1: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 1/28

Page 2: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 2/28

Page 3: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 3/28

Page 4: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 4/28

R otateR otate

R otateR esetR otateR eset

MoveMove

R esetAllR esetAll

R otate AnimationR otate Animation

R otate CondyleR otate Condyle

Page 5: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 5/28

Writing a macro (good luck)

Writing a macro (good luck)

�� NOTE: The following is a step NOTE: The following is a step--by by--stepstep

guide. However, the macros are alreadyguide. However, the macros are already

 present in this file, so you should not follow present in this file, so you should not follow

these steps, unless you do it in a newthese steps, unless you do it in a new

PowerPoint presentation, which does notPowerPoint presentation, which does not

contain any macros.contain any macros.

Page 6: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 6/28

Writing a macro (assuming noWriting a macro (assuming no

macros are already present)macros are already present)�� Open the Visual Basic Editor:Open the Visual Basic Editor:

Tools>Macro>Visual Basic Editor Tools>Macro>Visual Basic Editor 

�� In the Project box, select the VBProject andIn the Project box, select the VBProject and

then select Insert>Module from the menu.then select Insert>Module from the menu.

The code window opens. If not, doubleThe code window opens. If not, double--

click on the newly created moduleclick on the newly created module(Module1).(Module1).

Page 7: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 7/28

Writing a macro«

Writing a macro«

�� Position the mouse cursor in the code areaPosition the mouse cursor in the code area

(the large window on the right) and select(the large window on the right) and select

Insert>Procedure. Type ³SimpleR otate´ andInsert>Procedure. Type ³SimpleR otate´ and

make sure Sub and Public are selected.make sure Sub and Public are selected.

Click OK.Click OK.

�� In the code box, complete the procedure soIn the code box, complete the procedure soit looks like the following: (next slide)it looks like the following: (next slide)

Page 8: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 8/28

A simple procedure:A simple procedure:Public SubPublic Sub SimpleR otateSimpleR otate()()

DimDim aSlideaSlide As Slide, aShape As ShapeAs Slide, aShape As Shape

SetSet aSlideaSlide = ActivePresentation.Slides(4)= ActivePresentation.Slides(4)

Set aShape =Set aShape = aSlideaSlide.Shapes(1).Shapes(1)

aShape.R 

otation = aShape.R 

otation + 3aShape.R 

otation = aShape.R 

otation + 3End SubEnd Sub

Page 9: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 9/28

Writing a macro«

Writing a macro«

�� This procedure rotates the first shapeThis procedure rotates the first shape

(object) on Slide #4 by 3 degrees.(object) on Slide #4 by 3 degrees.

�� To see it in action we need to µattach¶ it toTo see it in action we need to µattach¶ it to

an action object. (next slide)an action object. (next slide)

Page 10: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 10/28

Create an action button

Create an action button

�� Slide 4 has an action button µR otate¶. ThisSlide 4 has an action button µR otate¶. This

was created by selecting: Slide Show >was created by selecting: Slide Show >

Action Buttons > CustomAction Buttons > Custom

�� Then drag the mouse on the slide to createThen drag the mouse on the slide to create

the button.the button.

Page 11: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 11/28

Create an action button«

Create an action button«

�� As soon as the button is created, the ActionAs soon as the button is created, the Action

Settings dialog box opens.Settings dialog box opens.

�� Select the R un Macro option and pick theSelect the R un Macro option and pick the

SimpleR otate macro from the list box.SimpleR otate macro from the list box.

�� The text on the button was entered after The text on the button was entered after 

rightright--clicking the button and selecting Addclicking the button and selecting Add

Text from the popText from the pop--up menu.up menu.

Page 12: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 12/28

 Now test it! Now test it!�� Go to slide #4.Go to slide #4.

�� Click the Slide Show icon on the lower leftClick the Slide Show icon on the lower left

of your screen.of your screen.

�� Use your mouse to click the R otate button.Use your mouse to click the R otate button.

The mandible and teeth should rotate eachThe mandible and teeth should rotate each

time the button is pressed.time the button is pressed.

Page 13: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 13/28

ProblemsProblems�� How do we translate?How do we translate?

�� How do we return the mandible to theHow do we return the mandible to the

original position?original position?

Page 14: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 14/28

More difficult problemsMore difficult problems�� R otation is around the center of theR otation is around the center of the

mandible. How do we rotate around themandible. How do we rotate around the

condyle?condyle?

�� If we have more shapes on the slide, how doIf we have more shapes on the slide, how do

we specify (in the macro) which shape willwe specify (in the macro) which shape will

move?move?

Page 15: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 15/28

Some info to solve the problemsSome info to solve the problems�� Slides have a coordinate system from 0,0 at theSlides have a coordinate system from 0,0 at the

upper left corner, to 720,540 at the lower right.upper left corner, to 720,540 at the lower right.

These coordinates hold for OnThese coordinates hold for On--screen Showscreen Show(File>Page Setup«).(File>Page Setup«).

�� Macros permanently alter the placement of Macros permanently alter the placement of 

objects. Therefore, we require a macro to returnobjects. Therefore, we require a macro to return

the object to the original position. Else, use thethe object to the original position. Else, use theUndo command (Edit>Undo) immediately after Undo command (Edit>Undo) immediately after 

running the macro.running the macro.

Page 16: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 16/28

More helpMore help�� An example of an undo macro for theAn example of an undo macro for the

SimpleR otate macro can be found in this file. It isSimpleR otate macro can be found in this file. It is

the SimpleR otateR eset macro. The main commandthe SimpleR otateR eset macro. The main commandis this:is this:

�� aShape.R otation = 0aShape.R otation = 0

�� The R otateR eset button on Slide #4 activates thisThe R otateR eset button on Slide #4 activates this

macro. So after using the R otate button, click themacro. So after using the R otate button, click the

R otateR eset button to return the mandible to theR otateR eset button to return the mandible to the

original position.original position.

Page 17: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 17/28

Translating objectsTranslating objects�� An example of a macro for translatingAn example of a macro for translating

objects is the SimpleMoveR ightDown. Useobjects is the SimpleMoveR ightDown. Use

the Move button on Slide #4 to activate it.the Move button on Slide #4 to activate it.

�� The SimpleR esetAll macro resets theThe SimpleR esetAll macro resets the

mandible to its original position.mandible to its original position.

Page 18: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 18/28

Animating movementAnimating movement�� You can create continuous animation byYou can create continuous animation by

repeating movements many times. Therepeating movements many times. The

SimpleR otateAnimation demonstrates this.SimpleR otateAnimation demonstrates this.The main code is this:The main code is this:

�� For n = 1 To 10For n = 1 To 10

�� aShape.R 

otation = aShape.R 

otation + 3aShape.R 

otation = aShape.R 

otation + 3�� DoEventsDoEvents

�� Next Next

Page 19: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 19/28

Animating movement«Animating movement«�� We see that the heart of the code is the sameWe see that the heart of the code is the same

as the SimpleR otate macro. It is justas the SimpleR otate macro. It is just

repeated 10 times.repeated 10 times.

�� The DoEvents command allows PowerPointThe DoEvents command allows PowerPoint

to redraw the slide after each rotation, soto redraw the slide after each rotation, so

that a continuous motion is perceived.that a continuous motion is perceived.

Page 20: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 20/28

Specifying the slide in the macroSpecifying the slide in the macro�� Slides in PowerPoint are held in a list. To specifySlides in PowerPoint are held in a list. To specify

e.g. slide #4, use a command such as this :e.g. slide #4, use a command such as this :

�� Set aSlide = ActivePresentation.Slides(4)Set aSlide = ActivePresentation.Slides(4)

�� If you know the name of the slide you can alsoIf you know the name of the slide you can also

use this syntax:use this syntax:

�� Set aSlide = ActivePresentation.Slides(³Mouth´)Set aSlide = ActivePresentation.Slides(³Mouth´)

Page 21: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 21/28

Page 22: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 22/28

R otating around any point

R otating around any point

�� To rotate an object around any point, use theTo rotate an object around any point, use the

R otateAround macro that is included in this file.R otateAround macro that is included in this file.

You should include it in your own macros likeYou should include it in your own macros likethis:this:

�� R otateAround aSlide.Shapes(1), 3, 190, 140R otateAround aSlide.Shapes(1), 3, 190, 140

�� (see the R otateCondyle macro and try the R otate(see the R otateCondyle macro and try the R otate

Condyle button on Slide #4. R emember to use theCondyle button on Slide #4. R emember to use the

R esetAll button to return the mandible to theR esetAll button to return the mandible to the

original position)original position)

Page 23: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 23/28

Helper fileHelper file�� PowerPoint does not have an easy way to renamePowerPoint does not have an easy way to rename

objects or slides, or to figure out the coordinates of objects or slides, or to figure out the coordinates of 

objects on a slide.objects on a slide.�� You can use the ShowShapes.ppt file to help youYou can use the ShowShapes.ppt file to help you

do this. Open the file in PowerPoint and then rundo this. Open the file in PowerPoint and then runthe ShowSlideObjects macro (with your .ppt filethe ShowSlideObjects macro (with your .ppt fileopen at the same time). A dialog box will open,open at the same time). A dialog box will open,which shows all shapes on the current slide. Youwhich shows all shapes on the current slide. Youcan rename the slide or the shapes on it. You cancan rename the slide or the shapes on it. You canalso see their Top, Left and R otation properties soalso see their Top, Left and R otation properties sothat you can write macros easier.that you can write macros easier.

Page 24: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 24/28

R eset

Example 1: Eruption and ankylosisExample 1: Eruption and ankylosis

Click the teeth on the left, then the teeth on the right.Click the teeth on the left, then the teeth on the right.

Click R eset to return them to the initial position.Click R eset to return them to the initial position.

Page 25: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 25/28

Example 2: Opening and closingExample 2: Opening and closing

OpenOpen

CloseClose

Page 26: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 26/28

Example 3: TorqueExample 3: Torque

Torque wireTorque wire Insert wireInsert wireTorque is expressedTorque is expressed

R eset

R eset

Click on the buttons in turn:Click on the buttons in turn:

Page 27: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 27/28

Example 4: Activate T loopExample 4: Activate T loop

ActivateActivate R esetR eset  Note: the template curves could be drawn with Note: the template curves could be drawn with

 No Line, and would be invisible. No Line, and would be invisible.

Page 28: Advanced Animation 2

8/6/2019 Advanced Animation 2

http://slidepdf.com/reader/full/advanced-animation-2 28/28

Good luck!Good luck!�� If you need help:If you need help:

 ±  ± www.dhal.comwww.dhal.com