1
たとえば、シークバーを100に移動すると、imageViewを1秒以内に100degに回転させます。問題は、すぐに50に移動して100にジャンプし、50にゆっくりと移動する場合です。 現在の位置から回転する方法はありますか?またはランダムな度合いのアニメーションをスムーズにするためのより洗練されたソリューションですか?スムーズローテーション
seekBar1 = (SeekBar) findViewById(R.id.seekBar1);
arrow2 = (ImageView) findViewById(R.id.imageView1);
seekBar1.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
{
public void onProgressChanged(SeekBar seekBar1, int progress, boolean fromUser)
{
currentSpeed.setText(""+progress);
RotateAnimation rotateAnimation = new RotateAnimation(fromPosition ,progress,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setDuration(1000);
rotateAnimation.setFillAfter(true);
arrow2.startAnimation(rotateAnimation);
fromPosition=progress;
}
public void onStartTrackingTouch(SeekBar seekSize1) {}
public void onStopTrackingTouch(SeekBar seekSize1) {}
});