Example usage for android.view.animation RotateAnimation setDuration

List of usage examples for android.view.animation RotateAnimation setDuration

Introduction

In this page you can find the example usage for android.view.animation RotateAnimation setDuration.

Prototype

public void setDuration(long durationMillis) 

Source Link

Document

How long this animation should last.

Usage

From source file:Main.java

public static void btnRotateSelf(View view) {
    RotateAnimation ra = new RotateAnimation(0, 360, RotateAnimation.RELATIVE_TO_SELF, 0.5F,
            RotateAnimation.RELATIVE_TO_SELF, 0.5F);
    ra.setDuration(1000);
    view.startAnimation(ra);/*from   ww w  . j ava  2 s .  c o  m*/
}

From source file:Main.java

public static void rotate180to360(View view) {
    RotateAnimation rotate = new RotateAnimation(180, 360, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotate.setDuration(ANIM);
    rotate.setInterpolator(new LinearInterpolator());
    rotate.setFillAfter(true);/*from  ww w  . j  a v a 2  s.  c o  m*/
    view.startAnimation(rotate);
}

From source file:Main.java

public static Animation rotationAnimation() {
    final RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotate.setDuration(600);
    rotate.setRepeatMode(Animation.RESTART);
    rotate.setRepeatCount(Animation.INFINITE);
    return rotate;

}

From source file:Main.java

private static RotateAnimation generateNormalRotate(float fromDegrees, float toDegrees) {
    RotateAnimation anim = new RotateAnimation(fromDegrees, toDegrees, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    anim.setDuration(350);
    anim.setFillAfter(true);//from   w  w  w. j av  a  2  s  .  com
    return anim;
}

From source file:Main.java

public static RotateAnimation getRotateAnimation(float fromDegrees, float toDegrees, int pivotXType,
        float pivotXValue, int pivotYType, float pivotYValue, long durationMillis,
        AnimationListener animationListener) {
    RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue,
            pivotYType, pivotYValue);/*w ww . j  av a 2  s . c  o m*/
    rotateAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        rotateAnimation.setAnimationListener(animationListener);
    }
    return rotateAnimation;
}

From source file:Main.java

public static Animation getRotateAnimation() {
    final RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    rotateAnimation.setDuration(1500);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setRepeatCount(Animation.INFINITE);
    return rotateAnimation;
}

From source file:Main.java

public static void startRepeatSelfRotateAnimation(View v, long duration, Animation.AnimationListener listener) {
    RotateAnimation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(duration);
    animation.setRepeatCount(-1); // Repeat animation
    animation.setFillAfter(true);/*from   w  w  w .j a va  2 s  .c o  m*/
    animation.setRepeatMode(Animation.INFINITE); //
    LinearInterpolator lir = new LinearInterpolator();
    animation.setInterpolator(lir);
    if (listener != null) {
        animation.setAnimationListener(listener);
    }
    v.startAnimation(animation);
}

From source file:Main.java

public static Animation getRotateAnimation(float fromDegrees, float toDegrees, long durationMillis) {
    RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotate.setDuration(durationMillis);
    rotate.setFillAfter(true);/*from   www  .  j  a v  a2s.  c  o  m*/
    return rotate;
}

From source file:Main.java

/**
 * Create a new rotating animation./*from w ww.j a v  a 2  s  .c om*/
 * @return a rotation animation
 */
public static RotateAnimation rotateAnimation() {
    RotateAnimation rotate = new RotateAnimation(0f, ROTATION, Animation.RELATIVE_TO_SELF, PIVOT,
            Animation.RELATIVE_TO_SELF, PIVOT);
    rotate.setDuration(ANIMATION_DURATION);
    rotate.setRepeatMode(Animation.RESTART);
    rotate.setRepeatCount(Animation.INFINITE);
    return rotate;
}

From source file:Main.java

public static void animateRotate(final View animated, float fromDegrees, float toDegrees,
        AnimationListener listener) {/*  w ww.j  a v a 2s.co m*/
    if (animated == null) {
        return;
    }

    final RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees, animated.getWidth() / 2,
            animated.getHeight() / 2);
    rotate.setDuration(ANIMATION_DURATION);
    rotate.setAnimationListener(listener);
    animated.startAnimation(rotate);
}