Thread: [Solved] animation and line movement
View Single Post
 
Old 12-11-2012, 04:47 AM
JohnWilson JohnWilson is offline Windows 7 64bit Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,914
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Unfortunately this is not simple to understand and you really need to understand VML paths.

Here's the code to move left (or right with postive values) in code by a set amount.

The VML Path is
M= Motion
0 0 From current position
L=Line
amount left measures in fractions of slide width
amount up and down in fractions oof slide height
E=End

Try this with various values and make sure the rectangle is selected.

Sub Left_xx()
Dim oshp As Shape
Dim oeff As Effect
Dim osld As Slide
Dim swCm
Dim HowFarLeft As Single

HowFarLeft = 7 'change this

swCm = Points2cm(ActivePresentation.PageSetup.SlideWidth)
If ActiveWindow.Selection.ShapeRange.Count <> 1 Then Exit Sub
Set oshp = ActiveWindow.Selection.ShapeRange(1)
Set osld = oshp.Parent
Set oeff = osld.TimeLine.MainSequence.AddEffect(oshp, msoAnimEffectPathLeft, msoAnimateLevelNone, msoAnimTriggerOnPageClick)
oeff.Behaviors(1).MotionEffect.Path = "M 0 0 L " & CStr(-(HowFarLeft / swCm)) & " 0 E"
End Sub



Function Points2cm(inVal As Single) As Single
Points2cm = inVal / 28.346
End Function
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote