Example usage for android.view.animation AnimationSet AnimationSet

List of usage examples for android.view.animation AnimationSet AnimationSet

Introduction

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

Prototype

public AnimationSet(boolean shareInterpolator) 

Source Link

Document

Constructor to use when building an AnimationSet from code

Usage

From source file:Main.java

public static AnimationSet getGatherTogetherAnimationSet(int x) {
    AnimationSet animSet = new AnimationSet(true);
    return null;
}

From source file:Main.java

public static AnimationSet getAnimationSet(Animation... animations) {
    AnimationSet set = new AnimationSet(true);
    for (Animation animation : animations)
        set.addAnimation(animation);/*from  w  ww .  ja v a  2 s  . c o m*/
    return set;
}

From source file:Main.java

public static void setButtonEffect(View view) {
    AnimationSet animationSet = new AnimationSet(true);
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.02f, 1.01f, 1.02f, 1.01f);
    scaleAnimation.setDuration(300);/*from ww  w. j  a v  a  2 s.c  om*/
    animationSet.addAnimation(scaleAnimation);
    view.startAnimation(animationSet);
}

From source file:Main.java

public static Animation shakeAnimation(int X) {
    AnimationSet set = new AnimationSet(true);
    Animation anim1 = getTranslateAnimation(0, -200, 0, 0, 100);
    anim1.setStartOffset(100);/*from w  w  w  .  j ava2  s .c  om*/
    set.addAnimation(anim1);
    Animation anim2 = getTranslateAnimation(-200, 400, 0, 0, 200);
    anim2.setStartOffset(300);
    set.addAnimation(anim2);
    Animation anim3 = getTranslateAnimation(400, -200, 0, 0, 200);
    anim3.setStartOffset(500);
    set.addAnimation(anim3);
    Animation anim4 = getTranslateAnimation(-200, 0, 0, 0, 100);
    anim4.setStartOffset(600);
    set.addAnimation(anim4);
    set.setFillAfter(true);
    set.setDuration(640);
    return set;
}

From source file:Main.java

public static Animation clickAnimation(float scaleXY, long durationMillis) {
    AnimationSet set = new AnimationSet(true);
    set.addAnimation(getScaleAnimation(scaleXY, durationMillis));
    set.setDuration(durationMillis);//from ww w.  j  av  a  2  s. co  m
    return set;
}

From source file:Main.java

public static AnimationSet flash(final android.view.animation.Animation.AnimationListener animationlistener) {
    final AnimationSet animationset = new AnimationSet(true);
    final AlphaAnimation alphaanimation = new AlphaAnimation(0F, 1F);
    alphaanimation.setStartOffset(500L);
    alphaanimation.setDuration(100L);/*from  www. j a va 2s  . c om*/
    animationset.addAnimation(alphaanimation);
    final AlphaAnimation alphaanimation1 = new AlphaAnimation(1F, 0F);
    alphaanimation1.setDuration(100L);
    alphaanimation1.setStartOffset(1200L);
    animationset.addAnimation(alphaanimation1);
    animationset.setAnimationListener(animationlistener);
    return animationset;
}

From source file:Main.java

public static AnimationSet FlipAnimation(int duration, int repeatCount) {
    AnimationSet flip = new AnimationSet(true);
    if (duration > 20) //Flip anim
    {/*from   ww  w  .ja  v a2s. c  om*/
        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 popup(View view) {

    AnimationSet animation = new AnimationSet(true);
    float pivotX = view.getWidth() / 2;
    float pivotY = view.getHeight() / 2;
    ScaleAnimation anim = new ScaleAnimation(0f, 1.1f, 0f, 1.1f, pivotX, pivotY);
    anim.setInterpolator(new LinearInterpolator());
    anim.setDuration(300);/*from   w  w  w .  j a v  a2s .c  o m*/
    animation.addAnimation(anim);

    anim = new ScaleAnimation(1.1f, 1f, 1.1f, 1f, pivotX, pivotY);
    anim.setInterpolator(new LinearInterpolator());
    anim.setDuration(100);
    anim.setStartOffset(300);
    animation.addAnimation(anim);

    view.startAnimation(animation);
}

From source file:Main.java

public static void showAnimation(View view) {
    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f);
    translateAnimation.setDuration(200);
    animationSet.addAnimation(translateAnimation);
    view.startAnimation(animationSet);/*from  w w  w  .  j a  v  a2 s  . co  m*/
}

From source file:Main.java

public static void backAnimation(View view) {
    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f);
    translateAnimation.setDuration(200);
    animationSet.addAnimation(translateAnimation);
    view.startAnimation(animationSet);//from  w ww . ja  va2  s  .  c  o m
}