Formula for a motion path

A

Alon Amit

Is it possible to use VB to create a motion path (for an animated
object) from a mathematical formula, or from an imported list of
coordinates?

In more detail: I'd like to be able to animate an object so that it
follows the graph of some function. Obviously I'm not thinking of any
of the custom paths that can be found under "More motion paths", and
I'm also not looking at bezier curves which I think is what "Curve"
under "Draw Custom Path" does.

Since it is possible to freely draw a path, there doesn't seem to be an
inherent limitation on the path's structure. However, there's no way to
input a formula, and I also couldn't see how to import a list of
coordinates and use them to create the path. So I guess the question
is: is the internal representation of path coordinates accessible to
VBA modules?

A more fundamental question would be: is it, in general, possible to
inspect the internal representation of an object, and modify it? How
can one tell which features of an object are modifiable by VB code and
which aren't?

Thanks!

Alon
 
A

Alon Amit

Thanks, this is very useful. It seems that the popup list does contain
properties that the selected object does not support; for instance, a
simple autoshape contains "AnimationSettings" in the popup list, but
when I try to run the macro I get an error message - "Object does not
support this property ot method".

Anyway, I'm afraid I still couldn't figure out if motion path
coordinats are accessible. I tried recording a macro in which I'm
creating a motion path; unfortunately, the macro records nothing. Does
this mean that animation cannot be created or modified from a macro?
Thanks again,

Alon
 
A

Alon Amit

Thanks Steve, this is very useful.

I did notice that some properties and methods that appear on the menu
after I type the period aren't really available for that object. For
instance, "AnimationSettings" appears for a simple Autoshape object,
but when I try to actually run the macro I get an error message.

Anyway, I'm still not sure if motion paths are visible to VBA. When I
tried to record a macro in which I created and edited motion paths in
an attempt to see what the objects' names are, the macro recorded
nothing :-( . Does this mean that VBA cannot create or modify a motion
path?

Thanks again,

Alon
 
A

Alon Amit

(Sorry for the double posting. For some reason my replies don't show up on
Google Groups).
 
A

Alon Amit

Thanks Steve, this is very useful.

I did notice that some properties and methods that appear on the menu
after I type the period aren't really available for that object. For
instance, "AnimationSettings" appears for a simple Autoshape object,
but when I try to actually run the macro I get an error message.

Anyway, I'm still not sure if motion paths are visible to VBA. When I
tried to record a macro in which I created and edited motion paths in
an attempt to see what the objects' names are, the macro recorded
nothing :-( . Does this mean that VBA cannot create or modify a motion
path?

Thanks again,

Alon
 
A

Alon Amit

Thanks again - this is really helpful! I'm getting closer...

Through Andrew May's text I found my way here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbapp10/html/ppobjMotionEffect.asp

This page has an example code that adds a star shape to the current
slide, and makes it animated with a custom path. If I could stack the
ToX and ToY properties and create an elaborate path - I've solved my
problem.

However, the code doesn't seem to work for me as is (I'm currently
using PowerPoint 2002 SP3). The object gets created OK and has custom
animation properties, but when I try to play the animation (either in
Slide Show mode or using the Play button on the Custom Animation pane),
the star just vanishes. This is strange.

The animation properties of the star created by the code are different
from those of an object I create manually. In the latter case, you see
a dashed line representing the path (with the green and red arrows at
the beginning and end points), and the animation type is called "Custom
Path". With the star, I see no path, and the animation type is just
"Custom". This is probably due to the msoAnimEffectCustom that's used
in the code, but I couldn't see that there is any
msoAnimEffectCustomPath alternative, so I guess this is actually the
one that should be used (I couldn't exactly figure it out from the MSDN
reference manual).
Any thoughts would be greatly appreciated - this is so close...

Alon
 
A

Alon Amit

Me should Bed also, but want to get animation work...

Shyam Pillai has a better version of this code, which *does* work,
here:

http://www.mcse.ms/message637367.html

He is correcting someone else's code which I had to tweak at some
points; for instance there are no "Set" commands and the m_objPpt
prefix seems not to agree with my version of the compiler. I'm not sure
what this is - an older version of the syntax?

Anyway, the object is now animated. The motion path still doesn't show,
and Pillai signs off with the following message:

"Another suggestion is: Instead of using the FromX, FromY, ToX and ToY
properties, create a VML motion path string and assign it to the Path
property. The major benefit is that then the user can edit the path in
the
UI."

Well, I'd love to do that, only I've no idea what a VML string is, what
syntax I should use for the path, and how to assign it to the Path
property. One possibly relevant entry in the manual is here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbapp11/html/ppproPath1.asp

Quite unbelievably, this page seems to mix references to *directory*
paths and *motion* paths(!). Anyway, there's not a word on how to
actually use the string for a motion path.

Just thought I'd help you make an interesting morning. Thanks again!
Alon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top