Reputation: 2830
The following is my View Animation
code:
final RotateAnimation rotateAnimation = new RotateAnimation(0, 63,
Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, 1);
For some reasons I have to use the ObjectAnimator
now. And I am unable to set the pivots of the view as I did in the View Animation. I tried the following but failed miserably.
PropertyValuesHolder pvhx2 = PropertyValuesHolder.ofFloat(View.ROTATION, 0, 63,
Animation.RELATIVE_TO_SELF, 1);
ObjectAnimator rotateAnimation3 = ObjectAnimator.ofPropertyValuesHolder(animationView, pvhx2);
Please help me in setting the pivot for rotation in this animation.
Upvotes: 1
Views: 864
Reputation: 21
You need set pivot in ObjectAnimator
like this:
PropertyValuesHolder pvhPivotX = PropertyValuesHolder.ofFloat("pivotX",0.5);
PropertyValuesHolder pvhPivotY = PropertyValuesHolder.ofFloat("pivotY",0.5);
ObjectAnimator rotateAnimation3 = ObjectAnimator.ofPropertyValuesHolder(animationView, pvhPivotX, pvhPivotY, ...);
Upvotes: 2