Example usage for android.animation ObjectAnimator setInterpolator

List of usage examples for android.animation ObjectAnimator setInterpolator

Introduction

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

Prototype

@Override
public void setInterpolator(TimeInterpolator value) 

Source Link

Document

The time interpolator used in calculating the elapsed fraction of this animation.

Usage

From source file:com.android.tv.menu.MenuLayoutManager.java

private ObjectAnimator createScaleXAnimator(View view, float from, float to) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.SCALE_X, from, to);
    animator.setDuration(mRowAnimationDuration);
    animator.setInterpolator(mFastOutSlowIn);
    return animator;
}

From source file:com.android.tv.menu.MenuLayoutManager.java

private ObjectAnimator createScaleYAnimator(View view, float from, float to) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.SCALE_Y, from, to);
    animator.setDuration(mRowAnimationDuration);
    animator.setInterpolator(mFastOutSlowIn);
    return animator;
}

From source file:com.android.tv.menu.MenuLayoutManager.java

private ObjectAnimator createTranslationYAnimator(View view, float from, float to) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, from, to);
    animator.setDuration(mRowAnimationDuration);
    animator.setInterpolator(mFastOutSlowIn);
    mPropertyValuesAfterAnimation.add(new ViewPropertyValueHolder(View.TRANSLATION_Y, view, 0));
    return animator;
}

From source file:babbq.com.searchplace.SearchActivity.java

@OnClick(R.id.fab)
protected void save() {
    // show the save confirmation bubble
    fab.setVisibility(View.INVISIBLE);
    confirmSaveContainer.setVisibility(View.VISIBLE);
    resultsScrim.setVisibility(View.VISIBLE);

    // expand it once it's been measured and show a scrim over the search results
    confirmSaveContainer.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

        @Override/*w w  w  . ja v  a2 s.c o m*/
        public boolean onPreDraw() {
            // expand the confirmation
            confirmSaveContainer.getViewTreeObserver().removeOnPreDrawListener(this);
            Animator reveal = ViewAnimationUtils.createCircularReveal(confirmSaveContainer,
                    confirmSaveContainer.getWidth() / 2, confirmSaveContainer.getHeight() / 2,
                    fab.getWidth() / 2, confirmSaveContainer.getWidth() / 2);
            reveal.setDuration(250L);
            reveal.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                    android.R.interpolator.fast_out_slow_in));
            reveal.start();

            // show the scrim
            int centerX = (fab.getLeft() + fab.getRight()) / 2;
            int centerY = (fab.getTop() + fab.getBottom()) / 2;
            Animator revealScrim = ViewAnimationUtils.createCircularReveal(resultsScrim, centerX, centerY, 0,
                    (float) Math.hypot(centerX, centerY));
            revealScrim.setDuration(400L);
            revealScrim.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                    android.R.interpolator.linear_out_slow_in));
            revealScrim.start();
            ObjectAnimator fadeInScrim = ObjectAnimator.ofArgb(resultsScrim, ViewUtils.BACKGROUND_COLOR,
                    Color.TRANSPARENT, ContextCompat.getColor(SearchActivity.this, R.color.scrim));
            fadeInScrim.setDuration(800L);
            fadeInScrim.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                    android.R.interpolator.linear_out_slow_in));
            fadeInScrim.start();

            // ease in the checkboxes
            //                saveDribbble.setAlpha(0.6f);
            //                saveDribbble.setTranslationY(saveDribbble.getHeight() * 0.4f);
            //                saveDribbble.animate()
            //                        .alpha(1f)
            //                        .translationY(0f)
            //                        .setDuration(200L)
            //                        .setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
            //                                android.R.interpolator.linear_out_slow_in));
            //                saveDesignerNews.setAlpha(0.6f);
            //                saveDesignerNews.setTranslationY(saveDesignerNews.getHeight() * 0.5f);
            //                saveDesignerNews.animate()
            //                        .alpha(1f)
            //                        .translationY(0f)
            //                        .setDuration(200L)
            //                        .setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
            //                                android.R.interpolator.linear_out_slow_in));
            return false;
        }
    });
}

From source file:com.waz.zclient.ui.cursor.CursorLayout.java

private ObjectAnimator getShowToolbarAnimator(View view, float fromValue, float toValue) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, fromValue, toValue);
    animator.setDuration(cursorToolbarAnimationDuration);
    animator.setStartDelay(getResources().getInteger(R.integer.animation_delay_short));
    animator.setInterpolator(new Expo.EaseOut());
    return animator;
}

From source file:com.sinyuk.jianyimaterial.widgets.FloatingToolbar.java

private void showDefaultImpl() {
    int rootWidth = mRoot.getWidth();
    setScaleX(0f);/*from   www . j a va 2  s.c  om*/

    float endFabX;

    if (mFabOriginalX > rootWidth / 2f) {
        endFabX = rootWidth / 2f + (mFabOriginalX - rootWidth / 2f) / 4f;
    } else {
        endFabX = rootWidth / 2f - (mFabOriginalX - rootWidth / 2f) / 4f;
    }

    if (mFab != null) {
        PropertyValuesHolder xProperty = PropertyValuesHolder.ofFloat(X, endFabX);
        PropertyValuesHolder yProperty = PropertyValuesHolder.ofFloat(Y, mFabOriginalY * 1.05f);
        PropertyValuesHolder scaleXProperty = PropertyValuesHolder.ofFloat(SCALE_X, 0);
        PropertyValuesHolder scaleYProperty = PropertyValuesHolder.ofFloat(SCALE_Y, 0);

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

    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(this, "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) {
            super.onAnimationStart(animation);
            setVisibility(View.VISIBLE);
            mFab.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mMorphing = false;
        }
    });
    objectAnimator.start();
}

From source file:com.android.deskclock.timer.TimerFullScreenFragment.java

private void gotoTimersView() {
    if (mLastVisibleView == null || mLastVisibleView.getId() == R.id.timers_list_page) {
        mTimerSetup.setVisibility(View.GONE);
        mTimersListPage.setVisibility(View.VISIBLE);
        mTimersListPage.setScaleX(1f);//w  w w. java2  s .  com
    } else {
        // Animate
        ObjectAnimator a = ObjectAnimator.ofFloat(mTimerSetup, View.SCALE_X, 1f, 0f);
        a.setInterpolator(new AccelerateInterpolator());
        a.setDuration(125);
        a.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                mTimerSetup.setVisibility(View.GONE);
                mTimersListPage.setScaleX(0);
                mTimersListPage.setVisibility(View.VISIBLE);
                ObjectAnimator b = ObjectAnimator.ofFloat(mTimersListPage, View.SCALE_X, 0f, 1f);
                b.setInterpolator(new DecelerateInterpolator());
                b.setDuration(225);
                b.start();
            }
        });
        a.start();
    }
    startClockTicks();
    mLastVisibleView = mTimersListPage;
}

From source file:com.boko.vimusic.ui.activities.AudioPlayerActivity.java

/**
 * @param v/*from ww w .  ja v  a 2s . c  o  m*/
 *            The view to animate
 * @param alpha
 *            The alpha to apply
 */
private void fade(final View v, final float alpha) {
    final ObjectAnimator fade = ObjectAnimator.ofFloat(v, "alpha", alpha);
    fade.setInterpolator(
            AnimationUtils.loadInterpolator(this, android.R.anim.accelerate_decelerate_interpolator));
    fade.setDuration(400);
    fade.start();
}

From source file:com.android.deskclock.timer.TimerFullScreenFragment.java

private void gotoSetupView() {
    if (mLastVisibleView == null || mLastVisibleView.getId() == R.id.timer_setup) {
        mTimerSetup.setVisibility(View.VISIBLE);
        mTimerSetup.setScaleX(1f);/*w w w. j a va 2 s  .  c o  m*/
        mTimersListPage.setVisibility(View.GONE);
    } else {
        // Animate
        ObjectAnimator a = ObjectAnimator.ofFloat(mTimersListPage, View.SCALE_X, 1f, 0f);
        a.setInterpolator(new AccelerateInterpolator());
        a.setDuration(125);
        a.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                mTimersListPage.setVisibility(View.GONE);
                mTimerSetup.setScaleX(0);
                mTimerSetup.setVisibility(View.VISIBLE);
                ObjectAnimator b = ObjectAnimator.ofFloat(mTimerSetup, View.SCALE_X, 0f, 1f);
                b.setInterpolator(new DecelerateInterpolator());
                b.setDuration(225);
                b.start();
            }
        });
        a.start();

    }
    stopClockTicks();
    mTimerSetup.updateDeleteButtonAndDivider();
    mLastVisibleView = mTimerSetup;
}

From source file:io.github.douglasjunior.androidSimpleTooltip.SimpleTooltip.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private synchronized void startFloatingAnimation() {
    final String property = mGravity == Gravity.TOP || mGravity == Gravity.BOTTOM ? "translationY"
            : "translationX";

    final ObjectAnimator anim1 = ObjectAnimator.ofFloat(mContentLayout, property, -mAnimationPadding,
            mAnimationPadding);// w  w w  .  j  ava 2  s  .  c om
    anim1.setDuration(mAnimationDuration);
    anim1.setInterpolator(new AccelerateDecelerateInterpolator());

    final ObjectAnimator anim2 = ObjectAnimator.ofFloat(mContentLayout, property, mAnimationPadding,
            -mAnimationPadding);
    anim2.setDuration(mAnimationDuration);
    anim2.setInterpolator(new AccelerateDecelerateInterpolator());

    AnimatorSet set = new AnimatorSet();
    set.playSequentially(anim1, anim2);
    set.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (isShowing()) {
                animation.start();
            }
        }
    });
    mAnimator = set;
    mAnimator.start();
}