Example usage for android.view.animation Animation setRepeatCount

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

Introduction

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

Prototype

public void setRepeatCount(int repeatCount) 

Source Link

Document

Sets how many times the animation should be repeated.

Usage

From source file:Main.java

public static void setAlphaInAnimation(final View v, final int duration) {
    Animation animation = new AlphaAnimation(0, 1);
    animation.setDuration(duration);/*w w  w .  j  a v  a  2s.  co  m*/
    animation.setRepeatCount(0);
    v.startAnimation(animation);
}

From source file:Main.java

public static Animation picInAnimation() {
    Animation animation = new TranslateAnimation(10, 200, 10, 400);
    animation.setDuration(2000);/*from   www . j  ava  2  s. c  o  m*/
    animation.setRepeatCount(1);
    return animation;
}

From source file:Main.java

public static void startBlink(View view) {
    if (null == view) {
        return;/*w  w w  . ja v a2 s  .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 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 v  a 2s.com
}

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;
}

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 void animaBotao(Button botao) {
    final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
    animation.setDuration(400);//from   w  w w  . ja  v a2  s . co  m
    animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
    animation.setRepeatCount(2);
    animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in
    botao.startAnimation(animation);
}

From source file:Main.java

public static void blink(View view, int durationMs, int repeatCount) {
    Animation anim = new AlphaAnimation(1.0f, 0.0f);
    anim.setDuration(durationMs); //You can manage the time of the blink with this parameter
    anim.setStartOffset(0);// w w  w .  j  a  v  a 2s .c  o  m
    anim.setRepeatMode(Animation.REVERSE);
    anim.setRepeatCount(repeatCount);
    view.startAnimation(anim);

}

From source file:Main.java

public static AnimationSet FlipAnimation(int duration, int repeatCount) {
    AnimationSet flip = new AnimationSet(true);
    if (duration > 20) //Flip anim
    {//w  w w .jav  a 2 s  .  com
        Animation from_middle1_anim = new ScaleAnimation(1.0f, 0.0f, 1.0f, 1.0f, Animation.RELATIVE_TO_SELF,
                .5f, Animation.RELATIVE_TO_SELF, .5f);
        from_middle1_anim.setDuration(duration);
        from_middle1_anim.setStartOffset(0);
        from_middle1_anim.setRepeatMode(Animation.REVERSE);
        from_middle1_anim.setRepeatCount(repeatCount);

        flip.addAnimation(from_middle1_anim);
    } else // no anim
    {
        Animation noAnim = new AlphaAnimation(1f, 1f);
        noAnim.setDuration(duration);
        flip.addAnimation(noAnim);
    }
    return flip;
}

From source file:Main.java

public static void setFlickerAnimation(View v) {
    final Animation animation = new AlphaAnimation(1, 0); // Change alpha
    animation.setDuration(500); // duration - half a second
    animation.setInterpolator(new LinearInterpolator()); // do not alter
                                                         // animation
                                                         // rate
    animation.setRepeatCount(Animation.INFINITE); // Repeat animation
                                                  // infinitely
    animation.setRepeatMode(Animation.REVERSE); //
    v.setAnimation(animation);/*from w w  w .j  a va 2s .com*/
}