ColorEffect 对象

         
AnimationBehavior
ColorEffect
ColorFormat

代表动画动作的一种颜色效果。

使用 ColorEffect 对象

使用 AnimationBehavior 对象的 ColorEffect 属性返回 ColorEffect 对象。颜色效果可以使用 ColorEffect 对象的 FromTo 属性更改,如下所示。颜色效果最初使用 To 属性设置,然后可以使用 By 属性按指定的编号进行更改。以下示例向当前演示文稿的第一张幻灯片中添加一个形状,并且将颜色效果动画动作设置为更改新形状的填充颜色。

Sub ChangeColorEffect()
    Dim sldFirst As Slide
    Dim shpHeart As Shape
    Dim effNew As Effect
    Dim bhvEffect As AnimationBehavior

    Set sldFirst = ActivePresentation.Slides(1)
    Set shpHeart = sldFirst.Shapes.AddShape(Type:=msoShapeHeart, _
        Left:=100, Top:=100, Width:=100, Height:=100)
    Set effNew = sldFirst.TimeLine.MainSequence.AddEffect _
        (Shape:=shpHeart, EffectID:=msoAnimEffectChangeFillColor, _
        Trigger:=msoAnimTriggerAfterPrevious)
    Set bhvEffect = effNew.Behaviors.Add(Type:=msoAnimTypeColor)

    With bhvEffect.ColorEffect
        .From.RGB = RGB(Red:=255, Green:=0, Blue:=0)
        .To.RGB = RGB(Red:=0, Green:=0, Blue:=255)
    End With
End Sub