I try to make the game of spin the wheel in Android. I find it hard to rotate the circle in the right way. I'd love help how to rotate the circle and stop it so I get a different result each time. At the moment it turns a defined amount of times and returns to the beginning. If I stop in the middle of it by this msmallWheelBack.clearAnimation() it returns to the start of the round. Thank you in advance for your help.
In my code:
Animation animation = AnimationUtils.loadAnimation(this, R.anim.rotate_around_center_point);
mframeWheelBig.startAnimation(animation);
The anim xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >
<rotate
android:duration="2500"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:toDegrees="360"
android:fromDegrees="0"
android:fillAfter="true"
android:fillBefore="true"
android:fillEnabled="true"/>
</set>
And like I said this is how I stop the animation
mframeWheelBig.clearAnimation();