Table of contents
TOC
折叠目录
展开目录

MotionEffect Object (PowerPoint)MotionEffect Object (PowerPoint)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

Represents a motion effect for an AnimationBehavior object.Represents a motion effect for an AnimationBehavior object.

示例Example

Use the MotionEffectpropety of the AnimationBehavior object to return a MotionEffect object. The following example refers to the motion effect for a given animation behavior.Use the MotionEffectpropety of the AnimationBehavior object to return a MotionEffect object. The following example refers to the motion effect for a given animation behavior.

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

Use the ByX, ByY, FromX, FromY, ToX, and ToYproperties of the MotionEffect object to construct a motion path. The ToY and ToX properties are in percentage, where ToX = 1.0 means 100% of slide width and ToY = 1.0 means 100% of slide height. The following example adds a shape to the first slide and creates a motion path.Use the ByX, ByY, FromX, FromY, ToX, and ToYproperties of the MotionEffect object to construct a motion path. The ToY and ToX properties are in percentage, where ToX = 1.0 means 100% of slide width and ToY = 1.0 means 100% of slide height. The following example adds a shape to the first slide and creates a motion path.

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

另请参阅See also

概念Concepts

PowerPoint 对象模型引用PowerPoint Object Model Reference

© 2018 Microsoft