设置或返回 Single 类型值,该值分别代表 ScaleEffect 或 MotionEffect 对象的最终宽度或水平位置,其值以屏幕宽度的百分比形式表示。可读写。
expression.ToX
expression 必选。该表达式返回“应用于”列表中的对象之一。
此属性的默认值为 Empty,此情况下使用对象的当前位置。
将此属性与 FromX 属性联合使用以便调整大小或从一个位置跳到另一个位置。
请勿将此属性与 ColorEffect、RotationEffect 或 PropertyEffect 对象的 To 属性相混淆,后者分别用于设置或更改动画动作的颜色、旋转或其他属性。
以下示例添加一个动画路径并且设置起始和结束的水平和垂直位置。
Sub AddMotionPath()
Dim effCustom As Effect
Dim animMotion As AnimationBehavior
Dim shpRectangle As Shape
'Adds shape and sets effect and animation properties
Set shpRectangle = ActivePresentation.Slides(1).Shapes _
.AddShape(Type:=msoShapeRectangle, Left:=100, _
Top:=100, Width:=50, Height:=50)
Set effCustom = ActivePresentation.Slides(1).TimeLine.MainSequence _
.AddEffect(Shape:=shpRectangle, effectId:=msoAnimEffectCustom)
Set animMotion = effCustom.Behaviors.Add(msoAnimTypeMotion)
'Sets starting and ending horizontal and vertical positions
With animMotion.MotionEffect
.FromX = 0
.FromY = 0
.ToX = 50
.ToY = 50
End With
End Sub