2014-02-26 4 views
0

아주 간단한 애니메이션을 시도하고 있습니다. 180 ° (상대) (+ 162 ° 절대), 다시 정상 0 ° (절대) (-162 ° 상대)로 오른쪽으로 돌립니다. ...거짓 각도를 사용하여 여러 개의 RotationAnimations (시간 이동)

int first = -18; 
int second = first +180; 
int animationGap = 500; 
//left rotation 
final RotateAnimation leftRotation = new RotateAnimation(0, first, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); 
leftRotation.setDuration(1000); 
leftRotation.setInterpolator(new AccelerateDecelerateInterpolator()); 
//right rotation 
final RotateAnimation rightRotation = new RotateAnimation(first, second, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); 
rightRotation.setDuration(1000); 
rightRotation.setStartOffset(1000+animationGap); 
rightRotation.setInterpolator(new AccelerateDecelerateInterpolator()); 
//back to normal rotation 
final RotateAnimation toNormalRotation = new RotateAnimation(second, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); 
toNormalRotation.setDuration(1000); 
toNormalRotation.setStartOffset(2000+animationGap*2); 
toNormalRotation.setInterpolator(new AccelerateDecelerateInterpolator()); 
//animation set 
final AnimationSet animationSet = new AnimationSet(true); 
animationSet.setInterpolator(new AccelerateDecelerateInterpolator()); 
animationSet.addAnimation(leftRotation); 
animationSet.addAnimation(rightRotation); 
animationSet.addAnimation(toNormalRotation); 

그리고 난이 가지고있는 전체의 번들을 시작 : first= -90; 예상하지만 완전히 상단 별자리 잘못 ...
(삼성 S4와 구글의 넥서스 S에서 테스트)입니다대로 작동

view.startAnimation(animationSet); 

물론 나는 이것을 AnimationListener으로 빨리 고칠 수 있고 다음 애니메이션을 시작하지만 이것은 실제 해결책이나 대답이 아닙니다.
내 이유를 알 수있는 사람이 있습니까?이 문제가 발생하는 이유는 무엇이며 어떻게 예방할 수 있습니까?
편집 :
문제는 마트 릭스 (회전은 각 otehr를 조작 할 수 있음)와 같은 언더 레이 수학 표현 일 수 있다고 생각합니다. 안드로이드가 이것을 인식 할 수 있기 때문에 또는 안드로이드 사이의 시간 지연 때문에 다른 것들을 생성 할 수 있기 때문에 문제가되어서는 안됩니다.
난 아직

답변

0

내 생각 엔 잘 때문에 유일한 해결책은 잠시 멈출 방법의 다음 각 하나의 회전 AnimationListener를 사용하여 시작했다 멋진 솔루션을 찾고 있어요 ..