Example usage for android.view.animation TranslateAnimation setInterpolator

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

Introduction

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

Prototype

public void setInterpolator(Interpolator i) 

Source Link

Document

Sets the acceleration curve for this animation.

Usage

From source file:Main.java

/**
 *    move the background view(translate animation).
 * /*from w  w  w.  jav  a 2 s.  c  o m*/
 * @param view
 *          the view will be moved
 * @param durationMillis
 *          translate animation duration
 * @param fromX
 *          from X coordinate
 * @param toX
 *          to X coordinate
 * @param fromY
 *          from Y coordinate
 * @param toY
 *          to Y coordinate
 */
public static void translateFromAbove(final Context context, final View view, final long durationMillis,
        boolean fillAfter, float fromX, float toX, final float fromY, final float toY) {
    TranslateAnimation translateAnimation = new TranslateAnimation(fromX, toX, fromY, toY + 5);
    translateAnimation.setInterpolator(new BounceInterpolator());
    translateAnimation.setDuration(durationMillis);
    translateAnimation.setFillAfter(fillAfter);//this animation performed will persist when it is finished
    view.startAnimation(translateAnimation);
}

From source file:Main.java

public static Animation inFromRightAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 1F, 2, 0F, 2, 0F, 2, 0F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation inFromBottomQuickAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, 0F, 2, 1F, 2, 0F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new DecelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation outToBottomQuickAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, 0F, 2, 0F, 2, 1F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation outToBottomAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, 0F, 2, 0F, 2, 1F);
    translateanimation.setDuration(600L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation inFromBottomAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, 0F, 2, 1F, 2, 0F);
    translateanimation.setDuration(600L);
    translateanimation.setInterpolator(new DecelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation inFromLeftAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, -1F, 2, 0F, 2, 0F, 2, 0F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation outToLeftAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, -1F, 2, 0F, 2, 0F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation outToRightAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, 1F, 2, 0F, 2, -1F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static void showViewFromBottom(View view) {
    if (view.getVisibility() == View.VISIBLE) {
        return;/*from   ww w.  j  ava2  s.  co  m*/
    }
    view.setVisibility(View.VISIBLE);
    int height = view.getHeight();
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0,
            Animation.ABSOLUTE, height, Animation.ABSOLUTE, 0);
    translateAnimation.setDuration(ANIMATION_DURATION);
    translateAnimation.setInterpolator(sAnimationInterpolator);
    view.startAnimation(translateAnimation);
}