Share via


MotionEffect オブジェクト

Microsoft PowerPoint Visual Basic リファレンス

MotionEffect オブジェクト

AnimationBehavior
MotionEffect

AnimationBehavior オブジェクトのアニメーション効果を表します。

使い方

MotionEffect オブジェクトを取得するには、AnimationBehavior オブジェクトの MotionEffect プロパティを使用します。次の使用例は、指定したアニメーション動作の効果を参照します。

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

アニメーションの軌跡を作成するには、MotionEffect オブジェクトの ByXByYFromXFromYToXToY のいずれかのプロパティを使用します。次の使用例は、スライド 1 に図形を追加し、アニメーションの軌跡を作成します。

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

End Sub