Header
PowerPoint tips, hints and tutorials that will change your presentations for ever!

INDEX

 

Jigsaws
Sounds
Video
Custom Shows
vba code
NaviSlides
Games for teachers
Bullets
Triggers
Security
Flash Cards
Multiple Instances
PowerPoint 2007
Mail Merge
Random events
Animation
Hyperlinks
Set spellcheck language


Home buttonTutorial buttonContact buttonProducts button


Custom Custom Animation in PowerPoint

A little known secret is that you can create your own custom animations in PowerPoint. This can only be done with code but once created the animations will play in PowerPoint without any code being present.

All animations are composed of a set of "behaviors" in this example we count the behaviors in a standard animation and then add a further behavior that just creates a pause or delay. This can be useful if you want a series of animations to repeat with a set delay between them.

Download the sample from HERE

On slide one the three shapes bounce with a two second delay between then

On slide two we have added a repeat hoping to run the animation five times - It doesn't work, you cannot use delays like this.

In slide three we have created an animation that adds a four second delay to each animation and now it works perfectly!

Lets look at the code


Sub addDelay()
Dim osld As Slide
Dim oshp As Shape
Dim oeff As Effect
Dim i As Integer
Const sngDelay As Single = 4 ' alter this to suit
Dim sngCurr As Single
On Error Resume Next
Err.Clear
Set osld = ActiveWindow.View.Slide
Set oshp = ActiveWindow.Selection.ShapeRange(1)
If Err <> 0 Then
MsgBox "Looks like no shape is selected!", vbCritical
Exit Sub
End If
Set oeff = osld.TimeLine.MainSequence.FindFirstAnimationFor(oshp)
If oeff Is Nothing Then
MsgBox "Looks like selection is not animated!", vbCritical
Exit Sub
End If
With oeff
sngCurr = oeff.Timing.Duration
i = oeff.Behaviors.Count
'Add Set Delay :
.Behaviors.Add(msoAnimTypeSet).SetEffect.Property = msoAnimVisibility
.Behaviors(i + 1).Timing.TriggerDelayTime = sngCurr
.Behaviors(i + 1).Timing.Duration = sngDelay
.Behaviors(i + 1).SetEffect.To = 1 ' oshp not hidden use 0 for hidden while delayed
End With
End Sub

First we check that a shape is selected and that it is animated.

Then we count the number of behaviors in the first animation and add a further on which add a delay of 4 secs (change this in the line Const sngDelay As Single = 4)

The code is basically saying AFTER the current animation duration keep me visible for another 4 seconds.

NOTE This is not for beginners with code, always work on a copy of anything important!

 

 
 

Back to the Index Page

POWERPOINT BLOG

Articles on your favourite sport

Free Microsoft PowerPoint Advice, help and tutorials, Template Links
This website is sponsored by Technology Trish Ltd
© Technology Trish 2007
Registered in England and Wales No.5780175
PowerPoint® is a registered trademark of the Microsoft Corporation