Example usage for android.view.animation Animation RESTART

List of usage examples for android.view.animation Animation RESTART

Introduction

In this page you can find the example usage for android.view.animation Animation RESTART.

Prototype

int RESTART

To view the source code for android.view.animation Animation RESTART.

Click Source Link

Document

When the animation reaches the end and the repeat count is INFINTE_REPEAT or a positive value, the animation restarts from the beginning.

Usage

From source file:Main.java

public static RotateAnimation getDialogRotateAnimation2() {
    RotateAnimation mAnim = new RotateAnimation(0, 360, Animation.RESTART, 0.5f, Animation.RESTART, 0.5f);
    mAnim.setDuration(2000);/*from   w w w.ja  v a 2 s.  c  o m*/
    mAnim.setRepeatCount(Animation.INFINITE);
    mAnim.setRepeatMode(Animation.RESTART);
    mAnim.setStartTime(Animation.START_ON_FIRST_FRAME);
    return mAnim;
}

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);//from   w ww .ja va 2 s .co  m
    rotate.setRepeatMode(Animation.RESTART);
    rotate.setRepeatCount(Animation.INFINITE);
    return rotate;

}

From source file:Main.java

private static void ApplyHorizontalScrollAnimation(View view, boolean left, int speed) {
    float sign = left ? 1f : -1f;
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.setRepeatCount(Animation.INFINITE);
    animationSet.setRepeatMode(Animation.RESTART);

    TranslateAnimation move = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, sign * 0.70f,
            Animation.RELATIVE_TO_PARENT, sign * -0.70f, Animation.RELATIVE_TO_PARENT, 0,
            Animation.RELATIVE_TO_PARENT, 0);
    move.setStartOffset(0);/*from w  w  w. ja v  a 2s .c  om*/
    move.setDuration(speed);
    move.setFillAfter(true);
    animationSet.addAnimation(move);
    view.startAnimation(animationSet);
}

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 RotateAnimation getRotateAnimation(float fromAngle, float toAngle, float pivotX, float pivotY,
        int intDuration, int intRepeatCount, boolean boolFillAfter) {
    RotateAnimation mAnmation = new RotateAnimation(fromAngle, toAngle, Animation.RELATIVE_TO_SELF, pivotX,
            Animation.RELATIVE_TO_SELF, pivotY);
    mAnmation.setDuration(intDuration);/*w  w w.java2 s.  co  m*/
    mAnmation.setFillAfter(boolFillAfter);
    if (intRepeatCount != 1) {
        mAnmation.setRepeatMode(Animation.RESTART);
        mAnmation.setRepeatCount(intRepeatCount);
    }
    // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    mAnmation.setInterpolator(new LinearInterpolator());
    return mAnmation;
}

From source file:Main.java

public static ScaleAnimation getScaleAnimation(float ScaleFromX, float ScaleToX, float ScaleFromY,
        float ScaleToY, float pivotX, float pivotY, int intDuration, int intRepeatCount,
        boolean boolFillAfter) {
    ScaleAnimation mAnmation = new ScaleAnimation(ScaleFromX, ScaleToX, ScaleFromY, ScaleToY,
            Animation.RELATIVE_TO_SELF, pivotX, Animation.RELATIVE_TO_SELF, pivotY);
    mAnmation.setDuration(intDuration);/*from w w w  . jav a 2  s.  c om*/
    mAnmation.setFillAfter(boolFillAfter);
    if (intRepeatCount != 1) {
        mAnmation.setRepeatMode(Animation.RESTART);
        mAnmation.setRepeatCount(intRepeatCount);
    }
    // translateAnimation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    return mAnmation;
}

From source file:Main.java

public static void setRotateAnimation(View view, float fromAngle, float toAngle, float pivotX, float pivotY,
        int intDuration, int intRepeatCount, boolean boolFillAfter) {
    RotateAnimation mAnmation = new RotateAnimation(fromAngle, toAngle, Animation.RELATIVE_TO_SELF, pivotX,
            Animation.RELATIVE_TO_SELF, pivotY);
    mAnmation.setDuration(intDuration);//from ww w  . j a va2 s  .  co m
    mAnmation.setFillAfter(boolFillAfter);
    if (intRepeatCount != 1) {
        mAnmation.setRepeatMode(Animation.RESTART);
        mAnmation.setRepeatCount(intRepeatCount);
    }
    // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    mAnmation.setInterpolator(new LinearInterpolator());
    view.startAnimation(mAnmation);
}

From source file:Main.java

public static void setScaleAnimation(View view, float ScaleFromX, float ScaleToX, float ScaleFromY,
        float ScaleToY, float pivotX, float pivotY, int intDuration, int intRepeatCount,
        boolean boolFillAfter) {
    ScaleAnimation mAnmation = new ScaleAnimation(ScaleFromX, ScaleToX, ScaleFromY, ScaleToY,
            Animation.RELATIVE_TO_SELF, pivotX, Animation.RELATIVE_TO_SELF, pivotY);
    mAnmation.setDuration(intDuration);/* w  ww . ja v a2s.c om*/
    mAnmation.setFillAfter(boolFillAfter);
    if (intRepeatCount != 1) {
        mAnmation.setRepeatMode(Animation.RESTART);
        mAnmation.setRepeatCount(intRepeatCount);
    }
    // translateAnimation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    view.startAnimation(mAnmation);
}

From source file:Main.java

public static Animation createForeverRotationAnimation() {
    Animation mRotateAnimation = new RotateAnimation(0, 1080, Animation.RESTART, 0.5f, Animation.RESTART, 0.5f);
    mRotateAnimation.setInterpolator(new LinearInterpolator());
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
    mRotateAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    return mRotateAnimation;
}

From source file:Main.java

public static Animation createForeverReverseRotationAnimation() {
    Animation mRotateAnimation = new RotateAnimation(720, 0, Animation.RESTART, 0.5f, Animation.RESTART, 0.5f);
    mRotateAnimation.setInterpolator(new LinearInterpolator());
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
    mRotateAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    return mRotateAnimation;
}