ColorEffect.From 属性 (PowerPoint)

设置或返回一个 ColorFormat 对象,该对象表示一个动画动作的起始 RGB 颜色值。

语法

expressionFrom

表达 一个代表 ColorEffect 对象的变量。

备注

将该属性与 To 属性联合使用可从一种颜色转换为另一种颜色。

不要混淆此属性与 FromXFromY 属性的 ScaleEffectMotionEffect 对象,仅用于缩放或动画效果。

示例

以下示例添加一个颜色效果并立即更改该效果的颜色。

Sub AddAndChangeColorEffect() 
    Dim effBlinds As Effect 
    Dim tlnTiming As TimeLine 
    Dim shpRectangle As Shape 
    Dim animColorEffect As AnimationBehavior 
    Dim clrEffect As ColorEffect 
 
    'Adds rectangle and sets effect and animation 
    Set shpRectangle = ActivePresentation.Slides(1).Shapes _ 
        .AddShape(Type:=msoShapeRectangle, Left:=100, _ 
        Top:=100, Width:=50, Height:=50) 
    Set effBlinds = t.MainSequence.AddEffect(Shape:=shpRectangle, _ 
        effectId:=msoAnimEffectBlinds) 
    Set animColorEffect = tlnTimming.MainSequence(1).Behaviors _ 
        .Add(Type:=msoAnimTypeColor) 
    Set clrEffect = animColorEffect.ColorEffect 
 
    'Sets the animation effect starting and ending colors 
    clrEffect.From.RGB = RGB(Red:=255, Green:=255, Blue:=0) 
    clrEffect.To.RGB = RGB(Red:=0, Green:=255, Blue:=255) 
End Sub

另请参阅

ColorEffect 对象

支持和反馈

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