Example usage for android.view.animation Animation setInterpolator

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

Introduction

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

Prototype

public void setInterpolator(Interpolator i) 

Source Link

Document

Sets the acceleration curve for this animation.

Usage

From source file:org.smssecure.smssecure.util.ViewUtil.java

private static Animation getAlphaAnimation(float from, float to, int duration) {
    final Animation anim = new AlphaAnimation(from, to);
    anim.setInterpolator(new FastOutSlowInInterpolator());
    anim.setDuration(duration);/*from www  .  j a va  2s.c o m*/
    return anim;
}

From source file:com.bluros.music.utils.FabAnimationUtils.java

public static void scaleOut(final View fab, long duration, final ScaleCallback callback) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        ViewCompat.animate(fab).scaleX(0.0F).scaleY(0.0F).alpha(0.0F)
                .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR).setDuration(duration).withLayer()
                .setListener(new ViewPropertyAnimatorListener() {
                    public void onAnimationStart(View view) {
                        if (callback != null)
                            callback.onAnimationStart();
                    }/*from   ww  w  . ja va 2s  .com*/

                    public void onAnimationCancel(View view) {
                    }

                    public void onAnimationEnd(View view) {
                        view.setVisibility(View.INVISIBLE);
                        if (callback != null)
                            callback.onAnimationEnd();
                    }
                }).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(fab.getContext(), R.anim.design_fab_out);
        anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR);
        anim.setDuration(duration);
        anim.setAnimationListener(new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
                if (callback != null)
                    callback.onAnimationStart();
            }

            public void onAnimationEnd(Animation animation) {
                fab.setVisibility(View.INVISIBLE);
                if (callback != null)
                    callback.onAnimationEnd();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
                //
            }
        });
        fab.startAnimation(anim);
    }
}

From source file:Main.java

public static Animation outToLeftAnimation() {
    Animation outtoLeft = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    outtoLeft.setDuration(350);//from   www . j ava 2s .c o m
    outtoLeft.setInterpolator(new AccelerateInterpolator());
    return outtoLeft;
}

From source file:Main.java

public static Animation outToRightAnimation() {
    Animation outtoRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    outtoRight.setDuration(350);//ww w.  ja v  a 2s .  c  o  m
    outtoRight.setInterpolator(new AccelerateInterpolator());
    return outtoRight;
}

From source file:Main.java

public static Animation outToLeftAnimation() {
    Animation outtoLeft = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    outtoLeft.setDuration(500);/*from  www .  j ava 2  s.c o  m*/
    outtoLeft.setInterpolator(new AccelerateInterpolator());
    return outtoLeft;
}

From source file:Main.java

public static Animation inFromLeftAnimation() {
    Animation inFromLeft = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    inFromLeft.setDuration(350);/*w ww .  ja va  2s  .  c o  m*/
    inFromLeft.setInterpolator(new AccelerateInterpolator());
    return inFromLeft;
}

From source file:Main.java

public static Animation inFromLeftAnimation() {
    Animation inFromLeft = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    inFromLeft.setDuration(500);//  ww w.ja  v a  2s  . co m
    inFromLeft.setInterpolator(new AccelerateInterpolator());
    return inFromLeft;
}

From source file:Main.java

public static Animation outToRightAnimation() {
    Animation outtoRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    outtoRight.setDuration(500);//from w  w w  .ja  va  2 s.co  m
    outtoRight.setInterpolator(new AccelerateInterpolator());
    return outtoRight;
}

From source file:Main.java

public static Animation slideOutAnimation() {
    Animation outtoRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    outtoRight.setDuration(500);/*  ww w  .  ja  va 2s.  c  o m*/
    outtoRight.setInterpolator(new AccelerateDecelerateInterpolator());
    return outtoRight;
}

From source file:Main.java

public static Animation inFromRightAnimation() {
    Animation inFromRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, +1.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    inFromRight.setDuration(300);/*from  w w w  .  ja va2  s . c om*/
    inFromRight.setInterpolator(new AccelerateInterpolator());
    return inFromRight;
}