2011-10-27 6 views
1

예를 들어 seekbar를 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) {} 
}); 

답변

0

나는이 질문이 꽤 오래 전 게시되었음을 알고있다. 그러나 나는 같은 문제로 고심하고 해결책을 생각해 냈다. 로우 패스 필터를 사용해야합니다. 이렇게하면 일부 잡음과 센서에서 나오는 "이상치"값이 필터링됩니다. this을보십시오.

관련 문제