PowerPoint) (MotionEffect 对象

代表一个 AnimationBehavior 对象的动画效果。

示例

使用 AnimationBehavior 对象的 MotionEffect 属性可返回 MotionEffect 对象。 下面的示例引用了给定的动画动作的运动效果。

ActivePresentation.Slides(1).TimeLine.MainSequence.Item.Behaviors(1).MotionEffect

使用ByXByYFromXFromYToX玩具MotionEffect 对象的属性构造的运动路径。 玩具ToX 属性是以百分比表示,其中 ToX = 1.0 意味着的幻灯片的宽度和 玩具 100%= 1.0 意味着 100%的幻灯片的高度。 下面的示例向第一张幻灯片添加一个形状并创建动作路径。

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 = .5
        .ToY = .5
    End With

End Sub

另请参阅

PowerPoint 对象模型引用

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。