Thursday, September 13, 2012

[android-developers] Re: Dynamically change fromDegrees and toDegrees params in RotateAnimation

I'm thinking maybe you should subclass Animation and override these two methods:


boolean

getTransformation(long currentTime, Transformation outTransformation, float scale)

Gets the transformation to apply at a specified point in time.

boolean

getTransformation(long currentTime, Transformation outTransformation)

Gets the transformation to apply at a specified point in time.




On Thursday, September 13, 2012 1:10:24 PM UTC-5, Hossein wrote:

I've defined RotateAnimation to rotate a ImageView. So, I want to stop the animation after some repeats. The scenario is as following :

First animation starts from -25 to 25 degree, after one animating, this should be change to -24 to 24 and reversely and ... and when reach to 0 to 0 this should be cancel.

    int intervalSize = -25;

   
RotateAnimation r = new RotateAnimation(intervalSize, intervalSize, pivotX, pivotY);
    r
.setDuration(3000);
    r
.setStartOffset(0);
    r
.setRepeatMode(RotateAnimation.REVERSE);
    r
.setRepeatCount(RotateAnimation.INFINITE);
    startAnimation
(r);
    r
.setAnimationListener(new AnimationListener() {

       
@Override
       
public void onAnimationStart(Animation animation) {

       
}

       
@Override
       
public void onAnimationRepeat(Animation animation) {
           
if (intervalSize == 0)
                animation
.cancel();
            intervalSize
--;
       
}

       
@Override
       
public void onAnimationEnd(Animation animation) {

       
}
   
});

Could any one please how can I reach to this ?

Thanks in advance‌:)

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment