Moving Objects or Shapes Slowly with VBA

Started by PhisioPhil, March 21, 2020, 02:34:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PhisioPhil

How can you move shapes slowly as in the famous Lava Lamp animation?  Or, can one still obtain the VBA code for the Ani Lava Lamp.vsd?  Is the computer time used?  For example, moving every second?

vojo

#1
moving shapes is different than animating shapes

Moving shapes:  Hold shift down and use arrows

Animating shape:  aka shapes changing on their own.  Visio is not really set up to do animation.
                           you will need VBA to do that.   it will be very complex.

PhisioPhil

#2
Thank you for your reply.  I once had a copy of the Lava Lamp VBA and it showed how to move the lava blobs very slowly using CellsSRC and math.  So far I cannot create the same slow movement that I require for my solution.    If anyone knows how, help would be very much appreciated.

Obsidian

#3
Hello.

In this video set showed Tanks game development process:
https://www.youtube.com/watch?v=qKmXNes9zro&list=PLt0Sv3_p1fPSM_iYzW8JM-MfzwYEGqifT
Game coded in VBA for Visio. Language is Russian but you can observe code - i think it will be interesting as example of shapes animation. All lessons on GitHub: https://github.com/Obsidian-pb/Visio-VBA-GladiatorsTanks
And may be from the darkness something beautiful will rize

PhisioPhil

#4
Thank you so much Obsidian.  I have save the Tanks code on my phone and cannot wait to see it on my computer. Again, thank you!
PhisioPhil

vojo

#5
if you have multiple animations concurrent, probably need a VBA timing wheel and individual VBA macros for each shape needing animation.   As timing will progresses, each VBA macro will have to check current "tick" and decide to do something or not

PhisioPhil

#6
Thank you, Vojo!  I was wondering about timing changes or movements and you have given me very good advice.
I will be attempting this.
PhisioPhil

Visio Guy

FYI: Ani Lava Lamp is here:

http://visguy.com/vgforum/index.php?topic=521.0

Re: timing, the Visio application has NoEventsPending and VisioIsIdle events that might also help. I think that if you have a lot of things to be moved, it might take automation longer than whatever tick-length you are using to move stuff. So you could wait until Visio is finished, then allow the next tick mark to move stuff again. Just thinking out loud...
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

vojo

also, I don't believe visio VBA is multi threaded / concurrent, so a long macros will skew the timing wheel (non linear), might need to wrestle with that (all macros do a little at a time, some sort of suspend/resume macro if longer than X, etc).