Example usage for android.view.animation AccelerateInterpolator AccelerateInterpolator

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

Introduction

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

Prototype

public AccelerateInterpolator() 

Source Link

Usage

From source file:com.github.rubensousa.stackview.animator.StackSlideAnimator.java

@Override
public void animatePop(Object item, View view) {
    ViewCompat.animate(view)//from  ww w.  j av  a 2 s  . c  o m
            .translationX(getMoveDirection() == MOVE_LEFT ? -view.getWidth() * 1.2f
                    : getMoveDirection() == MOVE_RIGHT ? view.getWidth() * 1.2f : 0.0f)
            .translationY(getMoveDirection() == MOVE_UP ? -view.getHeight()
                    : getMoveDirection() == MOVE_DOWN ? view.getHeight() : 0f)
            .translationZ(ViewCompat.getTranslationZ(view) * 2.5f).setInterpolator(new AccelerateInterpolator())
            .setDuration(getAnimationDuration()).setListener(new ViewPropertyAnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(View view) {
                    super.onAnimationEnd(view);
                    ViewCompat.animate(view).setListener(null);
                    getAnimationListener().onExitFinished(view);
                }
            });
}

From source file:com.savvasdalkitsis.betwixt.Interpolators.java

/**
 * <strong>ANDROID INTERPOLATOR</strong><br/><br/>
 * An interpolator where the rate of change starts out slowly and and then accelerates.
 *///from   ww  w .ja va2  s. c  o  m
@NonNull
public static Interpolator accelerate() {
    return new AccelerateInterpolator();
}

From source file:com.github.rubensousa.stackview.animator.StackSlideFadeAnimator.java

@Override
public void animatePop(Object item, final View view) {
    ViewCompat.animate(view).alpha(0.0f)
            .translationX(getMoveDirection() == MOVE_LEFT ? -view.getWidth() * 1.2f
                    : getMoveDirection() == MOVE_RIGHT ? view.getWidth() * 1.2f : 0.0f)
            .translationY(getMoveDirection() == MOVE_UP ? -view.getHeight()
                    : getMoveDirection() == MOVE_DOWN ? view.getHeight() : 0f)
            .translationZ(ViewCompat.getTranslationZ(view) * 2.5f).setInterpolator(new AccelerateInterpolator())
            .setDuration(getAnimationDuration()).setListener(new ViewPropertyAnimatorListenerAdapter() {
                @Override/* ww w . j  av  a 2 s .  c om*/
                public void onAnimationEnd(View view) {
                    super.onAnimationEnd(view);
                    ViewCompat.animate(view).setListener(null);
                    getAnimationListener().onExitFinished(view);
                }
            });
}

From source file:com.github.rubensousa.stackview.animator.StackSlideShrinkAnimator.java

@Override
public void animatePop(Object item, View view) {
    ViewCompat.animate(view).scaleY(0f).scaleX(0f)
            .translationY(getMoveDirection() == MOVE_UP ? -view.getHeight()
                    : getMoveDirection() == MOVE_DOWN ? view.getHeight() : 0f)
            .translationX(getMoveDirection() == MOVE_LEFT ? -view.getWidth() * 1.2f
                    : getMoveDirection() == MOVE_RIGHT ? view.getWidth() * 1.2f : 0.0f)
            .translationZ(ViewCompat.getTranslationZ(view) * 2.5f).setInterpolator(new AccelerateInterpolator())
            .setDuration(getAnimationDuration()).setListener(new ViewPropertyAnimatorListenerAdapter() {
                @Override/*w w  w . ja  v a 2  s. c  om*/
                public void onAnimationEnd(View view) {
                    super.onAnimationEnd(view);
                    ViewCompat.animate(view).setListener(null);
                    getAnimationListener().onExitFinished(view);
                }
            });
}

From source file:com.bobomee.android.navigator.expandable.Utils.java

/**
 * Creates interpolator.//  w w  w .  j  av a 2s. c o  m
 * @return  a timeinterpolator
 * @param interpolatorType a int value from 0 to 10
 */
public static TimeInterpolator createInterpolator(@IntRange(from = 0, to = 10) final int interpolatorType) {
    switch (interpolatorType) {
    case ACCELERATE_DECELERATE_INTERPOLATOR:
        return new AccelerateDecelerateInterpolator();
    case ACCELERATE_INTERPOLATOR:
        return new AccelerateInterpolator();
    case ANTICIPATE_INTERPOLATOR:
        return new AnticipateInterpolator();
    case ANTICIPATE_OVERSHOOT_INTERPOLATOR:
        return new AnticipateOvershootInterpolator();
    case BOUNCE_INTERPOLATOR:
        return new BounceInterpolator();
    case DECELERATE_INTERPOLATOR:
        return new DecelerateInterpolator();
    case FAST_OUT_LINEAR_IN_INTERPOLATOR:
        return new FastOutLinearInInterpolator();
    case FAST_OUT_SLOW_IN_INTERPOLATOR:
        return new FastOutSlowInInterpolator();
    case LINEAR_INTERPOLATOR:
        return new LinearInterpolator();
    case LINEAR_OUT_SLOW_IN_INTERPOLATOR:
        return new LinearOutSlowInInterpolator();
    case OVERSHOOT_INTERPOLATOR:
        return new OvershootInterpolator();
    default:
        return new LinearInterpolator();
    }
}

From source file:com.github.rubensousa.stackview.animator.StackFlipAnimator.java

@Override
public void animatePop(Object item, View view) {
    if (getMoveDirection() == MOVE_LEFT || getMoveDirection() == MOVE_RIGHT) {
        ViewCompat.animate(view).scaleX(0.3f).setDuration(getAnimationDuration() / 10);

        ViewCompat.animate(view)/*  ww  w.j  a  v a 2 s  . c o m*/
                .translationX(getMoveDirection() == MOVE_LEFT ? -view.getWidth() : view.getWidth())
                .translationZ(ViewCompat.getTranslationZ(view) * 2.5f)
                .rotationY(getMoveDirection() == MOVE_LEFT ? 180 : -180).setDuration(getAnimationDuration())
                .setInterpolator(new AccelerateInterpolator())
                .setListener(new ViewPropertyAnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(View view) {
                        super.onAnimationEnd(view);
                        ViewCompat.animate(view).setListener(null);
                        getAnimationListener().onExitFinished(view);
                    }
                });

    } else {
        ViewCompat.animate(view).scaleX(0.3f).scaleY(0f).setDuration(getAnimationDuration() / 10);

        ViewCompat.animate(view)
                .translationY(getMoveDirection() == MOVE_UP ? -view.getHeight() : view.getHeight())
                .translationZ(ViewCompat.getTranslationZ(view) * 2.5f)
                .rotationX(getMoveDirection() == MOVE_UP ? 180 : -180).setDuration(getAnimationDuration())
                .setInterpolator(new AccelerateInterpolator())
                .setListener(new ViewPropertyAnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(View view) {
                        super.onAnimationEnd(view);
                        ViewCompat.animate(view).setListener(null);
                        getAnimationListener().onExitFinished(view);
                    }
                });

    }

}

From source file:com.github.rubensousa.stackview.animator.StackFlipSlideAnimator.java

@Override
public void animatePop(Object item, View view) {
    ViewCompat.animate(view).scaleX(0.3f).scaleY(0.3f).setDuration(getAnimationDuration() / 10);

    if (getMoveDirection() == MOVE_LEFT || getMoveDirection() == MOVE_RIGHT) {
        ViewCompat.animate(view)//w  w  w.  j  a  va 2 s  .  c o m
                .translationX(getMoveDirection() == MOVE_LEFT ? -view.getWidth() : view.getWidth())
                .translationZ(ViewCompat.getTranslationZ(view) * 2.5f)
                .rotationY(getMoveDirection() == MOVE_LEFT ? 250 : -250).setDuration(getAnimationDuration())
                .setInterpolator(new AccelerateInterpolator())
                .setListener(new ViewPropertyAnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(View view) {
                        super.onAnimationEnd(view);
                        ViewCompat.animate(view).setListener(null);
                        getAnimationListener().onExitFinished(view);
                    }
                });

    } else {
        ViewCompat.animate(view)
                .translationY(getMoveDirection() == MOVE_UP ? -view.getHeight() : view.getHeight())
                .translationZ(ViewCompat.getTranslationZ(view) * 2.5f)
                .rotationX(getMoveDirection() == MOVE_UP ? 250 : -250).setDuration(getAnimationDuration())
                .setInterpolator(new AccelerateInterpolator())
                .setListener(new ViewPropertyAnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(View view) {
                        super.onAnimationEnd(view);
                        ViewCompat.animate(view).setListener(null);
                        getAnimationListener().onExitFinished(view);
                    }
                });

    }
}

From source file:com.my.math_quiz.views.ViewPagerWithCustomSpeedOfSwitchingPages.java

private void init(Context context) {
    Interpolator sInterpolator = new AccelerateInterpolator();
    try {// w  w w .ja v  a  2  s  .com
        Field mScroller;
        mScroller = ViewPager.class.getDeclaredField("mScroller");
        mScroller.setAccessible(true);
        FixedSpeedScroller scroller = new FixedSpeedScroller(this.getContext(), sInterpolator);
        // scroller.setFixedDuration(5000);
        mScroller.set(this, scroller);
    } catch (NoSuchFieldException e) {
        Log.d("exception", e + "");
    } catch (IllegalArgumentException e) {
        Log.d("exception", e + "");
    } catch (IllegalAccessException e) {
        Log.d("exception", e + "");
    }
}

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

@Override
public boolean animateAdd(RecyclerView.ViewHolder holder) {
    final View view = holder.itemView;
    int width = getWidth(holder);
    ViewCompat.animate(view).cancel();// www.ja va2s. c o  m
    ViewCompat.setTranslationX(holder.itemView, (float) -width);
    float interpolation = interpolator.getInterpolation((float) view.getTop() / layoutManager.getHeight());
    long startDelay = (long) (500 * interpolation);
    ViewCompat.animate(view).setStartDelay(Math.max(0, startDelay)).translationX(0)
            .setInterpolator(new AccelerateInterpolator());
    return true;
}

From source file:com.github.rubensousa.floatingtoolbar.FloatingAnimatorImpl.java

@Override
public void show() {
    super.show();
    int rootWidth = getRootView().getWidth();
    float endFabX;

    if (getFab().getLeft() > rootWidth / 2f) {
        endFabX = getFab().getLeft() - getFab().getWidth();
    } else {/*from   w  ww . j  av  a2s  .  c om*/
        endFabX = getFab().getLeft() + getFab().getWidth();
    }

    PropertyValuesHolder xProperty = PropertyValuesHolder.ofFloat(View.X, endFabX);
    PropertyValuesHolder yProperty = PropertyValuesHolder.ofFloat(View.Y, getFloatingToolbar().getY() * 0.95f);
    PropertyValuesHolder scaleXProperty = PropertyValuesHolder.ofFloat(View.SCALE_X, 0);
    PropertyValuesHolder scaleYProperty = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0);

    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getFab(), xProperty, yProperty,
            scaleXProperty, scaleYProperty);
    animator.setDuration(FAB_MORPH_DURATION);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.start();

    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(getFloatingToolbar(), "scaleX", 1f);
    objectAnimator.setDuration(CIRCULAR_REVEAL_DURATION);
    objectAnimator.setStartDelay(CIRCULAR_REVEAL_DELAY);
    objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    objectAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            getFloatingToolbar().setVisibility(View.VISIBLE);
            getFab().setVisibility(View.INVISIBLE);
        }
    });
    objectAnimator.start();
}