Hi,
We have a panel which shows an object moving across different positions on the panel. Each position represents a different data point. To make the display a bit smoother I have written code to animate the object fading in and out similar to the below (instead of just turning visibility on an off).
g = createAnimation();
animate(g, "rectangle", "backCol", "_Transparent", "Black", makeMapping("duration", 100));
if (show)
startAnimation(g, "keep", makeMapping("direction", "Forward"));
else
startAnimation(g, "keep", makeMapping("direction", "Backward"));
Once when running a simulation I have witnessed the object freeze in one position (ie not animate backward) while all other graphics display correctly. I can't find an issue in the code so I was wondering about the functionality of the animation.
- Is there any problem in running several startAnimations at the same time on the same animation? I have not used stopAnimation anywhere.
- Is it possible for the startAnimation not to execute successfully and what would cause this?
Thanks for your help.
Animation Question
- mkoller
- Posts:741
- Joined: Fri Sep 17, 2010 9:03 am
Re: Animation Question
startAnimation(): If the animation is already running, this function does nothing.
What you probably saw was the animation was running Forward, then you tried to start it again with Backward and that was ignored.
Just do stopAnimation() before starting it again.
What you probably saw was the animation was running Forward, then you tried to start it again with Backward and that was ignored.
Just do stopAnimation() before starting it again.