PowerPoint) (MotionEffect.ByX 屬性
設定或傳回 單一 代表擴充或水平移動指定百分比的螢幕寬度,根據是否它一起使用的 ScaleEffect 或 MotionEffect 物件,分別的物件。 例如,50 的動畫效果的值表示向右移動物件一半的螢幕寬度。 讀取/寫入。
語法
expression。 ByX
表達 代表 MotionEffect 物件的 變數。
傳回值
單一
註解
負數會向左水平移動物件。 可以使用浮點數 (例如,55.5)。
若要垂直調整或移動物件,使用 ByY 屬性。
如果設定 ByX 及 ByY 屬性物件調整或移動水平和垂直方向。
請勿將這個屬性與 所ColorEffect 、 RotationEffect 或 PropertyEffect 物件屬性是用來分別設定色彩、 旋轉或其他動畫行為的屬性。
範例
在下列範例中,會新增動畫路徑;然後設定圖案的水平及垂直移動方式。
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
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應