vba and animations

  • Thread starter Christine Fournier
  • Start date
C

Christine Fournier

Hi,

I am using VBA in PowerPoint 2003.
I'm new to VBA and I find that looking for informations about animation is
quite difficult. When I want to know what informations to give when I want to
insert a shape, it's quite easy because I can record a macro and then use
this information. Unfortunately, it's not possible for animation. Do you know
of any good tutorial about this ? For example, I would like to know how to
lenghten the path if I'm using msoAnimEffectPathRight or how to include a
sound with it.

On another subject, there is still no answer to my question here and I
haven't found an answer by myself :

http://www.microsoft.com/office/com...oc=en-us&dg=microsoft.public.powerpoint&fltr=

Thank you for your help. It is very appreciated.

Christine./
Exemple of code I am using, exploring userform and animations :

Private Sub CheckBox1_Click()
etoile = True
End Sub

Private Sub CheckBox2_Click()
carre = True
End Sub

Private Sub CheckBox3_Click()
cercle = True
End Sub

Private Sub CommandButton1_Click()
Me.hide
If etoile = True Then
Set formeEtoile =
ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShape5pointStar, 67.75, 60.12, 97.38, 84.75)
With formeEtoile
.Fill.ForeColor.RGB = RGB(255, 255, 0)
.Line.Weight = 4#
.Line.ForeColor.RGB = RGB(255, 102, 0)
.Line.BackColor.RGB = RGB(255, 255, 255)
End With
End If
If carre = True Then
Set formeCarre =
ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShapeRectangle, 67.75, 191.38, 88.88, 78)
With formeCarre
.Fill.ForeColor.SchemeColor = ppAccent2
.Fill.Transparency = 0#
.Line.Weight = 4#
.Line.ForeColor.RGB = RGB(128, 128, 128)
.Line.BackColor.RGB = RGB(255, 255, 255)
End With
End If
If cercle = True Then
Set formeCercle =
ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShapeOval,
67.75, 401.5, 122.75, 122.75)
With formeCercle
.Fill.ForeColor.RGB = RGB(255, 0, 255)
.Line.Weight = 4#
.Line.ForeColor.RGB = RGB(153, 204, 0)
.Line.BackColor.RGB = RGB(255, 255, 255)
End With
End If
If etoile = True And trajet = True Then
With
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeEtoile, effectid:=msoAnimEffectPathRight)
.Timing.SmoothEnd = False
.Timing.SmoothStart = False
.Timing.Speed = 1
.Timing.TriggerType = msoAnimTriggerAfterPrevious
.Timing.TriggerDelayTime = 1
End With
End If
If etoile = True And emphase = True Then
With
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeEtoile, effectid:=msoAnimEffectSpin)
.Timing.Duration = 2
.Timing.TriggerType = msoAnimTriggerAfterPrevious
.Timing.TriggerDelayTime = 1
End With
End If
If carre = True And trajet = True Then
With
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCarre, effectid:=msoAnimEffectPathRight)
.Timing.SmoothEnd = False
.Timing.SmoothStart = False
.Timing.Speed = 1
.Timing.TriggerType = msoAnimTriggerAfterPrevious
.Timing.TriggerDelayTime = 1
End With
End If
If carre = True And emphase = True Then
With
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCarre, effectid:=msoAnimEffectFlicker)
.Timing.Duration = 2
.Timing.TriggerType = msoAnimTriggerAfterPrevious
.Timing.TriggerDelayTime = 1
End With
End If
If cercle = True And trajet = True Then
With
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCercle, effectid:=msoAnimEffectPathRight)
.Timing.SmoothEnd = False
.Timing.SmoothStart = False
.Timing.Speed = 1
.Timing.TriggerType = msoAnimTriggerAfterPrevious
.Timing.TriggerDelayTime = 1
End With
End If
If cercle = True And emphase = True Then
With
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCercle, effectid:=msoAnimEffectWave)
.Timing.Duration = 2
.Timing.TriggerType = msoAnimTriggerAfterPrevious
.Timing.TriggerDelayTime = 1
End With
End If
End Sub

Private Sub OptionButton1_Click()
trajet = True
End Sub

Private Sub OptionButton2_Click()
emphase = True
End Sub
 
S

Shyam Pillai

Christine,
You can change the length of the motion path animation by editing the VML
information of the motion. Take a look at the string returned by the Path
property and parse the information from there.
You can read more about VML. Basically the motion string is a set of space
delimited coordinates representing lines or bezier curves. The dimensions
are relative to the size of the slide.

Sub AddMotionPath()

Dim shpNew As Shape
Dim effNew As Effect
Dim aniMotion As AnimationBehavior

Set shpNew = ActivePresentation.Slides(1).Shapes _
.AddShape(Type:=msoShape5pointStar, Left:=0, _
Top:=0, Width:=100, Height:=100)
Set effNew = ActivePresentation.Slides(1).TimeLine.MainSequence _
.AddEffect(Shape:=shpNew, effectId:=msoAnimEffectCustom, _
Trigger:=msoAnimTriggerWithPrevious)
Set aniMotion = effNew.Behaviors.Add(msoAnimTypeMotion)

With aniMotion.MotionEffect
.Path = "M 0 0 L -0.25 0 E"
End With

End Sub

Regards,
Shyam Pillai

Image Importer Wizard
http://skp.mvps.org/iiw.htm

Hi there,


Regards,
Shyam Pillai

Animation Carbon
http://www.animationcarbon.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top