title: Android AnimationSet Sequence behaving differently depending on who i add first
body: <p>I am using AnimationSet to make a sequence of animations on a dynamically created view. I use the startoffset to control who starts first. however, the animation behaves differently depending on the order on which I use AnimationSet.AddAnimation with those animations. shouldn't it not matter, and shouldn't it just refer to the startoffset?</p>
  
  <p>I mean if I have a translation animation tAnimation, a scale animation sAnimation, another translate animation tAnimation2, and a rotation animation rAnimation.</p>
  
  <p>and I want them to happen as follows:</p>
  
  <p>1- <b>tAnimation</b> and <b>rAnimation</b> together at the beginning for a <b>Duration=1000 ms</b><br/>
  2- <b>sAnimation</b> and <b>tAnimation2</b> happen together <b>after</b> the first two animations, and last for <b>500 ms</b></p>
  
  <p>things would be like</p>
  
  <pre><code>AnimationSet s = new AnimationSet(false);
  
  //.... Animations definition
  //..
  //....
  //...
  
  tAnimation.setDuration(1000);
  rAnimation.setDuration(1000);
  
  sAnimation.setDuration(500);
  sAnimation.setStartOffset(1000); //offsets at the duration of the first set
  
  tAnimation2.setDuration(500);
  tAnimation2.setStartOffset(1000); //offsets at the duration of the first set
  
  
  //does it matter here who I add first to the animation set? 
  //because if I change the order in which i add the animations to the animation set, I get different results
  
  s.addAnimation(rAnimation);
  s.addAnimation(tAnimation);
  s.addAnimation(tAnimation2);
  s.addAnimation(sAnimation);
  </code></pre>
  
  <p>Noting that I use a custom defined AnimationListener on the <b>AnimationSet</b> and only implemented its "AnimationEnd" handler to set the final location of the imageview i am animating after all animations are done.</p>
  
  <p>and to add more info here, here's what I want to do in a picture.</p>
  
  <p>I have imageviews scattered allover the screen in random positions and random rotations (I have those locations stored) - the scenario goes as follows:</p>
  
  <p>1- when the user clicks on any of the Imageviews on the screen
  2- the clicked imageview (object) moves to the center of the screen (center of the object is on the center of the screen) and rotates to the angle 0
  3- then the clicked imageview expands to a specified scale ratio, and moves up to be exactly above the center of the screen..</p>
  
  <p>get a sketch of what I am trying to do here (I am unable to post images because I am short of reputation points): <a href="https://dl.dropboxusercontent.com/u/10306740/app.jpg" rel="nofollow">https://dl.dropboxusercontent.com/u/10306740/app.jpg</a></p>