title: Smooth floating animation using translation in XML
body: <p>I'm developing a game for Android in Eclipse and I'm trying to get an image to smoothly translate up and down to look like it's floating up and down infinitely. As is, it translates smoothly, but looks choppy in the transition from going down to going up and vice versa. I don't believe I have a firm grasp on how fromDelta and toDelta work as far as units. I've tried searching this site and google for information on this, but, while able to find solutions to all my other issues this way, was not able to find a solution for this.</p>
  
  <p>My code for the XML animation file is below:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
  android:fillEnabled="true"
  android:fillAfter="true" &gt;
  
  &lt;alpha android:fromAlpha="0.0" android:toAlpha="1.0" 
        android:interpolator="@android:anim/accelerate_interpolator" 
        android:duration="1000"
        android:fillAfter="true"/&gt;
  
  &lt;translate
  android:interpolator="@android:anim/linear_interpolator"
  android:fromYDelta="0%p"
  android:toYDelta="10%p"
  android:duration="2000"
  android:startOffset="0"
  android:repeatCount="infinite"&gt;&lt;/translate&gt;
  
  &lt;translate
  android:interpolator="@android:anim/linear_interpolator"
  android:fromYDelta="10%p"
  android:toYDelta="-10%p"
  android:duration="2000"
  android:startOffset="2000"
  android:repeatCount="infinite"&gt;&lt;/translate&gt;
  
  &lt;/set&gt;
  </code></pre>
  
  <p>I've tried doing from 10%p to 0%p in the second translate but that didn't work. Neither did from 10%p to 0%p. Any help would be greatly appreciated. Thanks!</p>