I am trying to create a moving ball animation in my app everything is working fine, ball moved as i want but it is not smooth. I tried everything to make it smooth but no luck every time i failed.
here is my xml code:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="true" >
<translate
android:duration="3000"
android:fromXDelta="-1%p"
android:fromYDelta="-87%p"
android:toXDelta="1%p"
android:toYDelta="-40%p" />
<translate
android:duration="3000"
android:fromXDelta="2%p"
android:fromYDelta="0%p"
android:startOffset="2200"
android:toXDelta="0%p"
android:toYDelta="42%p" />
<translate
android:duration="4000"
android:fromXDelta="0%p"
android:fromYDelta="42%p"
android:startOffset="4500"
android:toXDelta="-5%p"
android:toYDelta="0%p" />
<translate
android:duration="4000"
android:fromXDelta="0%p"
android:fromYDelta="0%p"
android:startOffset="5500"
android:toXDelta="4%p"
android:toYDelta="-47%p" />
</set>
and here is my java code:
ImageView image = (ImageView)findViewById(R.id.imageView1);
Animation anim = AnimationUtils.loadAnimation(this, R.drawable.moveing_ball_anim);
image.startAnimation(anim);
I move image in this shape.
You need to try to use LinearInterpolator instead AccelerateInterpolator.
Go through this link, and try to implement it. You will get your solution. Link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With