MotionEffect 对象:代表 AnimationBehavior 对象的动作效果。
使用 MotionEffect 对象
使用 AnimationBehavior 对象的 MotionEffec 属性返回 MotionEffect 对象。以下示例引用给定动画动作的动作效果。
ActivePresentation.Slides(1).TimeLine.MainSequence.Item.Behaviors(1).MotionEffect
使用 MotionEffect 对象的 ByX、ByY、FromX、FromY、ToX 和 ToY 属性创建动作路径。以下示例在第一张幻灯片中添加一个形状并创建动作路径。
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
.FromX = 0
.FromY = 0
.ToX = 666
.ToY = 777
End With
End Sub