Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Animation position bug?

I'm fairly new to Titanium so I'm not sure if this is a bug or a misuse on my part but I think I've found an issue with imageviews and animation. If I create an imageview, display its position, then animate it 200 pixels to the right and display its position again, there is no change in position. I am using left and top positioning in all cases (not center). I have tried the very same thing using center positioning and animatedCenter but I get the same result. Has anyone else seen this behavior? Is it a reported bug?

An example of my situation (I'm simplifying the real code):

var myImageview = Titanium.UI.createImageView({



myImageview.animate({left:200}, function(){alert(myImageview.left);

…both times it reports "0", whereas I would expect it to be 0 in the first case and 200 in the second.

— asked June 10th 2010 by Tony Masciola
  • animate
  • imageview

3 Answers

  • Accepted Answer

    I think you actually have to pass the new centered point with the animate function. See this example: http://github.com/appcelerator/KitchenSink/blob/master/1.3.x/KitchenSink/Resources/examples/animation_points.js … its exactly what you're trying do plus it also moves down. Download kitechsink and look under animation to see the demo.

    — answered June 12th 2010 by Sj Singh
  • Try this

      var a = Ti.UI.createAnimation();
          a.left = 200;
          a.duration = 500;
    — answered June 10th 2010 by Daniel Lim
    1 Comment
    • @Daniel: Thank you for the idea. I thought for sure you had the solution there but it seems to produce the same result. It still shows the end result of myImageview.left = 0 (even though the imageview has clearly animated to left = 200). It's very possible that I have another mistake hidden in there that is causing all of this but I can't find anything. Did you actually compile code with your suggestion and get a different result? That would help me narrow down the cause of the issue.

      — commented June 10th 2010 by Tony Masciola
  • Has anyone encountered this issue? Can anyone prove it working (with either method described here) so I can narrow it down to my own mistake? I am pretty much dead in the water with some core code I'm developing until I solve this. Any help is GREATLY appreciated. Thanks.

    — answered June 12th 2010 by Tony Masciola
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.