Androidでホイールを回すゲームを作ろうとしています。円を正しい方法で回転させるのは難しいと思います。毎回異なる結果が得られるように、円を回転させて停止する方法を教えてください。その時点で規定回数回転し、最初に戻ります。この msmallWheelBack.clearAnimation() で途中で止まると、ラウンドの最初に戻ります。よろしくお願いいたします。
私のコードでは:
Animation animation = AnimationUtils.loadAnimation(this, R.anim.rotate_around_center_point);
mframeWheelBig.startAnimation(animation);
アニメーション 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>
そして、私が言ったように、これがアニメーションを停止する方法です
mframeWheelBig.clearAnimation();