Reputation: 23
I have a very long PPT table of 687cm height containing 100's lines moving slowly vertically in the bottom/up direction. The table is pasted from an other source so handling it in one single animated object is the simplest and most productive way to go.
I am using VBA to set animation parameters because they are beyond the limits allowed by user interface (ex: max duration through UI is 10' where I need 30' or more), also drawing manually the animation end point (red point) beyond slide boundary is just painful.
So I have 3 questions below all related to the MotionEffect object:
1/ Given my table length, I expect to set MotionEffect.ToY to about -2000 % (for bottom/up translation).
When I execute the macro, ToY and Duration are indeed set (see sample spy below), however the path line with green/red ends is not reflected on the slide for the animated object (long table) So animation does not execute as desired (path and speed). However, Duration is correctly reflected in the animation pane.
2/ Online documentation for MotionEffect.ToY property states:
Returns or sets a Single that represents the vertical position of a MotionEffect object, specified as a percentage of the screen width. Read/write.
I would have expected ToY to represent a percentage of screen height rather than screen width. Is there any explanation why same width reference is taken both for ToX and ToY rather than width and height respectively?
3/ Now, a problem with speed of motion along vertical line.
With a height of 687cm, I calculate the expected ToY = 687 / 33.867 (slide width) - 1 = 19 thus I am setting ToY = 1900%
With such a path length, if I set Duration to 10' I expect speed to be more than 1cm / second. But actually, i observe a much slower speed about 3-4 times slower than the expected speed. Even, if I reduce ToY by a factor 2 or 4, it does not change speed...
I must have misunderstood something in ToY usage (when I use it on a simple object the ToY percentage I set are well reflected when animation runs).
Thanks for your help
Sub Scroll_Table()
Dim oDoc As Presentation
Dim oText As Shape
Dim speed, inch, resol, ptSize, txtHeight
Set oDoc = ActivePresentation
cnt = oDoc.Slides(1).Shapes.Count
Set oText = oDoc.Slides(1).Shapes(1)
' Point & Inch conversions
inch = 2.54 ' cm
resol = 72 ' = 72 / inch
ptSize = inch / resol ' = inch / resol
' Position object below side area
oText.Top = oDoc.PageSetup.SlideHeight
txtHeight = oText.Height
' Duration in Minutes read from the table name (trick!) in PPT
play_duration_M = oText.Name
play_duration_S = play_duration_M * 60
play_duration_mS = play_duration_S * 1000
' Expected speed (in cm/sec)
speed = (txtHeight * ptSize) / play_duration_S
' Translation length
trY = 100 * (-txtHeight / oDoc.PageSetup.SlideWidth - 1)
' Set animation trajectory and duration
With oDoc.Slides(1).TimeLine.MainSequence(1).Behaviors.Item(1)
.MotionEffect.ToY = trY
.Timing.Duration = play_duration_S
Debug.Print oDoc.PageSetup.SlideHeight, .Timing.Duration, .MotionEffect.ToY, txtHeight, speed
End With
With oDoc.SlideShowSettings
'.RangeType = ppShowAll
.Run
End With
End Sub
Upvotes: 0
Views: 144
Reputation: 23
Finally, I found a way to make it work properly by setting the property MotionEffet.Path. The unit used in the Path property is a proportion (not a %) of respectively SlideWidth / SlideHeight. Setting Path positions correctly the green / red dots of the trajectory.
Upvotes: 1