Animating the position of an object

I’m building a demo for a customer and am trying to animate the position of an object on the screen (it can be in one of 2 places). There appears to be no way to bind to an object’s coordinates, so I got it working using the fpmi.gui.moveComponent function in a script (launched by clicking on an on-screen object). However, I noticed that this only operates on the client clicked on, so different clients can get out of synch.

I found a solution by setting a SQLTag in the script and putting the moveComponent function in a timer object script which checks the value of the tag. This works, but it seems a rather coarse way of achieving animation.

Is there a better way?


I’m not quite sure how you are setting the position (some kind of config parameters maybe?), but you don’t need a timer. What I do is just put my moveComponent script in a property change action script. Then, if either of the x or y coordinates change, the script is fired.

I’ve attached a sample screen. The button has a dynamic property called “Position”, and I bind it to the values of the sliders. These values can obviously come from tags, a table, or anywhere, and all I’m doing with this property anyway is detecting a property change. So, whenever either of the x,y values change, the string changes, and the button propertyChange event is triggered.

There are a lot of different ways to do it, but you get the idea. Does this help? Maybe I misunderstood your question, but this gets you away from using timers at least.
Animate.fwin (8.5 KB)


That was just the help I needed! It’s taking me a while to get used to the event-driven style of programming with FactoryPMI.

Because this is a demo, I am ‘moving’ bits of plant around the screen by clicking on radio buttons, sliders etc. I’ve noticed that if you want to keep manual controls in synch between different PCs, you have to tie their selected / value property to SQLTags points and make the links bi-directional. If you don’t do this your customer can get confused when you try to give them a remote demo and nothing is being set at their end!

Thanks again.