Nested Animations
Hey guys,
I may be a tad naïve in asking this, but what is the problem with having nested animations? I've noticed that this can create some bugs when run in
the simulator, such as animations locking up the app. However, I have been unable to repeat these on the actual iPad itself…
When run in the simulator I get a range of messages such as:
[DEBUG] ignoring new layout while animating..
[DEBUG] animated called and we're not ready
and even
[DEBUG] animation guard triggered, we exceeded the timeout on waiting for view to become ready
I've come from a background of working with flash (a program which I understand breeds naïve/unexperienced developers)… I understand that Titanium isn't exactly optimised for doing a large amount of graphic/animation work, but so far I have found it to perform an AWFUL lot faster than the Flash Packager for iPhone. My project is basically just a childrens book with some basic animations of the characters moving. E.g. an arm rotating e.t.c
6 Answers
-
Accepted Answer
Views still have background work to complete upon creation before you animate them. Unfortunately you have to wait till they're finished and I know of no callback that lets you know when they finish.
-
I had the same problem just now. Turned out I forgot to add the view to the window. After I did that all works fine.
-
What does that mean ? Can we ignore this error ? because the app it self works perfect and the user can not see this error!
-
Hi guys,
I know this post was written 3 years ago, but I found another solution : don't forget to set a width to your view, especially if you work with MVC and Alloy.
I didn't set any width for my view because the normal layout rules VISUALLY set it to 100%. In fact, the "animation manager" (or whatever it is called) couldn't animate-left my view because it had a width of 0px.
So don't forget to set the width before using any animation. Hope it will help.Cheers.
-
I know this is an old thread but I've been playing around with this, maybe it can be helpful. To animate two object simultaneously and not get any warnings is fairly simple. Just insert this code into app.js and play. The code works but it is not cleaned, do not have much time right now …
Try it yourself. /Jonnivar self = Titanium.UI.createWindow({ backgroundColor : "#005494", exitOnClose : true }); var view01 = Titanium.UI.createView({ top : 0, height : "100%", width : 80, backgroundColor : "#FFC900", id : "View01", }); var view02 = Titanium.UI.createView({ top : 75, left : 0, height : 80, width : "100%", id : "View02", backgroundColor : "#FFC900" }); var view = Titanium.UI.createView({ top : 64, left : 0, height : 44, width : 320, id : "View", backgroundColor : "#005494", }); var animation1 = Titanium.UI.createAnimation({ }); var animation2 = Titanium.UI.createAnimation({ }); function ICommandYouToAnimate() { animation1 = Titanium.UI.createAnimation({ "opacity" : 1, "duration" : 800, "left" : 100, "curve" : Ti.UI.ANIMATION_CURVE_EASE_IN_OUT, }); animation2 = Titanium.UI.createAnimation({ "opacity" : 1, "duration" : 800, "top" : 200, "curve" : Ti.UI.ANIMATION_CURVE_EASE_IN_OUT, }); view01.animate(animation1); view02.animate(animation2); setTimeout(function() { animation1.opacity = 0.5; animation2.opacity = 0.5; view01.animate(animation1); }, 1000); setTimeout(function() { animation2.opacity = 0.5; animation1.opacity = 0.5; view02.animate(animation2); }, 2000); return; } ICommandYouToAnimate(); setTimeout(function() { self.remove(view02); self.remove(view01); self.add(view02); self.add(view01); ICommandYouToAnimate(); }, 10000); self.add(view02); self.add(view01); self.open();
-
In my case, I simply added an event listener to solve the problem:
myViewToAnimate.addEventListener('load',function() { // animation code; )};