Example usage for android.view.animation Animation INFINITE

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

Introduction

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

Prototype

int INFINITE

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

Click Source Link

Document

Repeat the animation indefinitely.

Usage

From source file:Main.java

public static AlphaAnimation fadeBackgroundAnimation() {
    AlphaAnimation alpha = new AlphaAnimation(0.5f, 0.2f);
    alpha.setRepeatCount(Animation.INFINITE);
    alpha.setRepeatMode(Animation.REVERSE);
    alpha.setDuration(1200);/*from ww w.  j av a2  s  .  c  o m*/
    alpha.setFillAfter(true);
    return alpha;
}

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 ww.  j  a  va2s  .c om
    mAnim.setRepeatCount(Animation.INFINITE);
    mAnim.setRepeatMode(Animation.RESTART);
    mAnim.setStartTime(Animation.START_ON_FIRST_FRAME);
    return mAnim;
}

From source file:Main.java

public static RotateAnimation getRotateAnimation() {
    RotateAnimation ra = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    ra.setDuration(1000);/*from   w w  w  . ja v  a 2  s.c o m*/
    ra.setStartOffset(0);
    ra.setRepeatCount(Animation.INFINITE);
    return ra;
}

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 ww  w .j  a v a2 s . c o  m
    move.setDuration(speed);
    move.setFillAfter(true);
    animationSet.addAnimation(move);
    view.startAnimation(animationSet);
}

From source file:Main.java

public static void startTranslationAnimation(View view) {
    TranslateAnimation translateAnimation = new TranslateAnimation(-50f, 50f, 0, 0);
    translateAnimation.setDuration(1000);
    translateAnimation.setRepeatCount(Animation.INFINITE);
    translateAnimation.setRepeatMode(Animation.REVERSE);
    view.setAnimation(translateAnimation);
    translateAnimation.start();//from www  .java2s  .com
}

From source file:Main.java

public static void animateView(View view) {
    final Animation animation = new AlphaAnimation(1f, 0f);
    animation.setDuration(1000); // Animate for 1 seconds
    animation.setInterpolator(new LinearInterpolator());
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.REVERSE);
    view.startAnimation(animation);/*from ww w.j a  va  2  s .com*/
}

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 w w . j a v  a  2  s  . c  om*/
    rotate.setRepeatMode(Animation.RESTART);
    rotate.setRepeatCount(Animation.INFINITE);
    return rotate;

}

From source file:Main.java

public static void SetFlickerAnimation(final TextView v, final String info, final String temp) {
    v.setText(info);//  ww w . j av a2s  .c  o  m
    AlphaAnimation anim = new AlphaAnimation(0, 1);
    anim.setDuration(4000);
    anim.setRepeatCount(Animation.INFINITE);
    // anim1.setRepeatMode(Animation.REVERSE);
    anim.setAnimationListener(new AnimationListener() {
        @Override
        public void onAnimationStart(Animation arg0) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onAnimationRepeat(Animation arg0) {
            // TODO Auto-generated method stub
            num++;
            if (num == 10) {
                num = 0;
            }
            if (num % 2 == 0) {
                v.setText(info);
            } else {
                v.setText(temp);
            }
        }

        @Override
        public void onAnimationEnd(Animation arg0) {
            // TODO Auto-generated method stub

        }
    });
    v.startAnimation(anim);

}

From source file:Main.java

public static void startBlink(View view) {
    if (null == view) {
        return;/* w w w .  ja va2s.c o  m*/
    }
    Animation alphaAnimation = new AlphaAnimation(1, 0);
    alphaAnimation.setDuration(500);
    alphaAnimation.setInterpolator(new LinearInterpolator());
    alphaAnimation.setRepeatCount(Animation.INFINITE);
    alphaAnimation.setRepeatMode(Animation.REVERSE);
    view.startAnimation(alphaAnimation);
}

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);//from   w w  w.ja  v a2 s. c o  m
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setRepeatCount(Animation.INFINITE);
    return rotateAnimation;
}