Visio Guy

Visio Discussions => Programming & Code => Topic started by: PhisioPhil on March 21, 2020, 02:34:10 PM

Title: Moving Objects or Shapes Slowly with VBA
Post by: PhisioPhil on March 21, 2020, 02:34:10 PM
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?
Title: Re: Moving Objects or Shapes Slowly with VBA
Post by: vojo on March 22, 2020, 03:01:36 AM
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.
Title: Re: Moving Objects or Shapes Slowly with VBA
Post by: PhisioPhil on March 22, 2020, 04:32:36 PM
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.
Title: Re: Moving Objects or Shapes Slowly with VBA
Post by: Obsidian on March 23, 2020, 02:28:10 AM
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
Title: Re: Moving Objects or Shapes Slowly with VBA
Post by: PhisioPhil on March 23, 2020, 03:42:56 AM
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
Title: Re: Moving Objects or Shapes Slowly with VBA
Post by: vojo on March 23, 2020, 04:12:12 AM
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
Title: Re: Moving Objects or Shapes Slowly with VBA
Post by: PhisioPhil on March 23, 2020, 04:06:25 PM
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
Title: Re: Moving Objects or Shapes Slowly with VBA
Post by: Visio Guy on March 23, 2020, 04:40:30 PM
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...
Title: Re: Moving Objects or Shapes Slowly with VBA
Post by: vojo on March 23, 2020, 05:51:03 PM
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).