Example usage for android.view.animation DecelerateInterpolator DecelerateInterpolator

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

Introduction

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

Prototype

public DecelerateInterpolator() 

Source Link

Usage

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 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 void translationY(View view, int translationY, int duration, int startDelay,
        Animator.AnimatorListener listener) {
    view.animate().translationY(translationY).setDuration(duration).setStartDelay(startDelay)
            .setInterpolator(new DecelerateInterpolator()).setListener(listener);

}

From source file:Main.java

public static void alpha(View view, float alpha, int duration, int startDelay,
        Animator.AnimatorListener listener) {
    view.animate().alpha(alpha).setDuration(duration).setStartDelay(startDelay)
            .setInterpolator(new DecelerateInterpolator()).setListener(listener);
}

From source file:Main.java

public static void linearAnimation(final View view, final int startX, final int startY, final int endX,
        final int endY, long duration, final Runnable callback) {
    Animation anim = new TranslateAnimation(startX, endX, startY, endY);
    anim.setDuration(duration);/*  www.  j av  a2 s.  c o m*/
    anim.setInterpolator(new DecelerateInterpolator());
    view.startAnimation(anim);

    anim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            view.clearAnimation();
            view.setX(view.getX() + endX);
            view.setY(view.getY() + endY);

            if (callback != null)
                callback.run();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
}

From source file:Main.java

/**
 * Helps to show views.//from w w w  .ja v  a  2 s.  c  o m
 *
 * @param views             Views to show.
 * @param animationDuration Animation duration.
 * @param animationDelay    Animation delay.
 */
static void orderedShowViews(final List<View> views, long animationDuration, int animationDelay) {
    if (views != null) {
        for (int viewIndex = 0; viewIndex < views.size(); viewIndex++) {
            final View childView = views.get(viewIndex);
            childView.setVisibility(View.VISIBLE);
            final ScaleAnimation scaleAnimation = new ScaleAnimation(0, childView.getScaleX(), 0,
                    childView.getScaleY(), Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
            scaleAnimation.setInterpolator(new DecelerateInterpolator());
            scaleAnimation.setDuration(animationDuration);
            scaleAnimation.setStartOffset(viewIndex * animationDelay);
            childView.startAnimation(scaleAnimation);
        }
    }
}

From source file:Main.java

@NonNull
private static AnimatorSet createDisappearAnim(View btnPanel, View recyclerView, View locationTxt,
        View headline) {/*from   w  w  w.ja v a  2  s  .c  o  m*/
    AnimatorSet animAll = new AnimatorSet();

    Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 1, 0);
    Animator anim1_2 = ObjectAnimator.ofFloat(btnPanel, View.ALPHA, 1, 0);
    Animator anim1_3 = ObjectAnimator.ofFloat(btnPanel, View.ALPHA, 1, 0);
    Animator anim1_4 = ObjectAnimator.ofFloat(recyclerView, View.ALPHA, 1, 0);
    setBatchTiming(400, 0, anim1_1, anim1_2, anim1_3, anim1_4, anim1_4);
    animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4);

    Interpolator interpolator2 = new DecelerateInterpolator();
    Animator anim2_1 = ObjectAnimator.ofFloat(locationTxt, View.ALPHA, 1, 0);
    Animator anim2_2 = ObjectAnimator.ofFloat(locationTxt, View.SCALE_X, 1f, 2f);
    Animator anim2_3 = ObjectAnimator.ofFloat(locationTxt, View.SCALE_Y, 1f, 2f);
    anim2_1.setInterpolator(interpolator2);
    anim2_2.setInterpolator(interpolator2);
    anim2_3.setInterpolator(interpolator2);
    setBatchTiming(800, 0, anim2_1, anim2_2, anim2_3);
    animAll.play(anim2_1).with(anim2_2).with(anim2_3).after(anim1_1);
    return animAll;
}

From source file:Main.java

@NonNull
private static AnimatorSet createDisappearAnim(View startBtn, View pick1, View pick2, View image,
        View headline) {/*from  w  w w .  ja v a  2  s  . c  o m*/
    AnimatorSet animAll = new AnimatorSet();

    Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 1, 0);
    Animator anim1_2 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 1, 0);
    Animator anim1_3 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 1, 0);
    Animator anim1_4 = ObjectAnimator.ofFloat(pick1, View.ALPHA, 1, 0);
    Animator anim1_5 = ObjectAnimator.ofFloat(pick2, View.ALPHA, 1, 0);
    setBatchTiming(400, 0, anim1_1, anim1_2, anim1_3, anim1_4, anim1_5);
    animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4).with(anim1_5);

    Interpolator interpolator2 = new DecelerateInterpolator();
    Animator anim2_1 = ObjectAnimator.ofFloat(image, View.ALPHA, 1, 0);
    Animator anim2_2 = ObjectAnimator.ofFloat(image, View.SCALE_X, 1f, 2f);
    Animator anim2_3 = ObjectAnimator.ofFloat(image, View.SCALE_Y, 1f, 2f);
    anim2_1.setInterpolator(interpolator2);
    anim2_2.setInterpolator(interpolator2);
    anim2_3.setInterpolator(interpolator2);
    setBatchTiming(800, 0, anim2_1, anim2_2, anim2_3);
    animAll.play(anim2_1).with(anim2_2).with(anim2_3).after(anim1_1);
    return animAll;
}

From source file:com.animedetour.android.view.animator.SlideInLeftAnimator.java

@Override
public boolean animateRemove(RecyclerView.ViewHolder holder) {
    final View view = holder.itemView;
    int width = getWidth(holder);
    ViewCompat.animate(view).cancel();//from  w ww.j a  va 2  s.c  o m
    float interpolation = interpolator.getInterpolation((float) view.getTop() / layoutManager.getHeight());

    ViewCompat.animate(view).setStartDelay((long) (500 * interpolation)).translationX(width).alpha(0)
            .setInterpolator(new DecelerateInterpolator());
    return true;
}

From source file:co.uk.aging.mabel.places.placepicker.cardstream.CardActionButton.java

@Override
public boolean onTouchEvent(MotionEvent event) {

    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN: {
        setPressed(true);// w ww . jav  a2s.com
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
            animate().scaleX(0.98f).scaleY(0.98f).setDuration(100)
                    .setInterpolator(new DecelerateInterpolator());
        } else {
            ViewCompat.setElevation(this, 8.f);
        }
        break;
    }
    case MotionEvent.ACTION_UP:
    case MotionEvent.ACTION_CANCEL: {
        setPressed(false);
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
            animate().scaleX(1.f).scaleY(1.f).setDuration(50).setInterpolator(new BounceInterpolator());
        } else {
            ViewCompat.setElevation(this, 0.f);
        }
        break;
    }
    }

    return super.onTouchEvent(event);
}