Author Topic: Moving Objects or Shapes Slowly with VBA  (Read 370 times)

0 Members and 1 Guest are viewing this topic.

PhisioPhil

  • Newbie
  • *
  • Posts: 4
Moving Objects or Shapes Slowly with VBA
« on: March 21, 2020, 09:34:10 AM »
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?
« Last Edit: March 23, 2020, 11:41:36 AM by Visio Guy »

vojo

  • Hero Member
  • *****
  • Posts: 1421
Re: Moving Objects or Shapes Slowly with VBA
« Reply #1 on: March 21, 2020, 10:01:36 PM »
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.
« Last Edit: March 23, 2020, 11:41:45 AM by Visio Guy »

PhisioPhil

  • Newbie
  • *
  • Posts: 4
Re: Moving Objects or Shapes Slowly with VBA
« Reply #2 on: March 22, 2020, 11:32:36 AM »
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.
« Last Edit: March 23, 2020, 11:41:27 AM by Visio Guy »

Obsidian

  • Jr. Member
  • **
  • Posts: 12
    • AIGS GraFiS-Tactic
Re: Moving Objects or Shapes Slowly with VBA
« Reply #3 on: March 22, 2020, 09:28:10 PM »
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
« Last Edit: March 23, 2020, 11:41:52 AM by Visio Guy »
And may be from the darkness something beautiful will rize

PhisioPhil

  • Newbie
  • *
  • Posts: 4
Re: Moving Objects or Shapes Slowly with VBA
« Reply #4 on: March 22, 2020, 10:42:56 PM »
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
« Last Edit: March 23, 2020, 11:42:24 AM by Visio Guy »

vojo

  • Hero Member
  • *****
  • Posts: 1421
Re: Moving Objects or Shapes Slowly with VBA
« Reply #5 on: March 22, 2020, 11:12:12 PM »
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
« Last Edit: March 23, 2020, 11:42:14 AM by Visio Guy »

PhisioPhil

  • Newbie
  • *
  • Posts: 4
Re: Moving Objects or Shapes Slowly with VBA
« Reply #6 on: March 23, 2020, 11:06:25 AM »
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
« Last Edit: March 23, 2020, 11:42:06 AM by Visio Guy »

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1707
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Moving Objects or Shapes Slowly with VBA
« Reply #7 on: March 23, 2020, 11:40:30 AM »
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

  • Hero Member
  • *****
  • Posts: 1421
Re: Moving Objects or Shapes Slowly with VBA
« Reply #8 on: March 23, 2020, 12: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).