设置或返回 Single 类型值,该值代表按指定的屏幕宽度百分比垂直缩放或移动对象,它取决于 MotionEffect 对象是与 ScaleEffect 联合使用,还是分别使用。可读写。
expression.ByY
expression 必选。该表达式返回“应用于”列表中的对象之一。
负数表示水平向左移动对象。浮点数(例如 55.5)有效。
若要水平缩放或移动对象,请使用 ByX 属性。
如果同时设置 ByX 和 ByY 属性,则可以在水平和垂直两个方向缩放或移动对象。
请勿将此属性与 ColorEffect、RotationEffect 或 PropertyEffect 对象的 By 属性相混淆,它们分别用于设置动画动作的颜色、旋转或其他属性。
以下示例添加了一个动画路径;然后设置形状在水平和垂直方向上的移动。
Sub AddMotionPath()
Dim effCustom As Effect
Dim animBehavior As AnimationBehavior
Dim shpRectangle As Shape
'Adds rectangle and sets effect and animation
Set shpRectangle = ActivePresentation.Slides(1).Shapes _
.AddShape(Type:=msoShapeRectangle, Left:=300, _
Top:=300, Width:=300, Height:=150)
Set effCustom = ActivePresentation.Slides(1).TimeLine _
.MainSequence.AddEffect(Shape:=shpRectangle, _
effectId:=msoAnimEffectCustom)
Set animBehavior = effCustom.Behaviors.Add(msoAnimTypeMotion)
'Specifies animation motion
With animBehavior.MotionEffect
.ByX = 50
.ByY = 50
End With
End Sub