Search in sources :

Example 16 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project ViewAnimator by florent37.

the class MainActivity method animateSequentially.

protected void animateSequentially() {
    ViewAnimator.animate(image).dp().width(100f, 150f).alpha(1, 0.1f).interpolator(new DecelerateInterpolator()).duration(800).thenAnimate(image).dp().width(150f, 100f).alpha(0.1f, 1f).interpolator(new AccelerateInterpolator()).duration(1200).start();
    ViewAnimator.animate(image).scaleX(0, 1).scaleY(0, 1).alpha(0, 1).decelerate().duration(500).thenAnimate(image).scaleX(1, 0).scaleY(1, 0).alpha(1, 0).accelerate().duration(500);
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator)

Example 17 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project MaterialLogin by fanrunqi.

the class RegisterActivity method animateRevealClose.

public void animateRevealClose() {
    Animator mAnimator = ViewAnimationUtils.createCircularReveal(cvAdd, cvAdd.getWidth() / 2, 0, cvAdd.getHeight(), fab.getWidth() / 2);
    mAnimator.setDuration(500);
    mAnimator.setInterpolator(new AccelerateInterpolator());
    mAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            cvAdd.setVisibility(View.INVISIBLE);
            super.onAnimationEnd(animation);
            fab.setImageResource(R.drawable.plus);
            RegisterActivity.super.onBackPressed();
        }

        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
        }
    });
    mAnimator.start();
}
Also used : Animator(android.animation.Animator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 18 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project LookLook by xinghongfei.

the class TopNewsDescribeActivity method enterAnimation.

private void enterAnimation() {
    float offSet = mToolbar.getHeight();
    LinearInterpolator interpolator = new LinearInterpolator();
    AccelerateInterpolator accelerateInterpolator = new AccelerateInterpolator();
    viewEnterAnimation(mToolbar, offSet, interpolator);
    viewEnterAnimationNest(mNest, 0f, accelerateInterpolator);
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator)

Example 19 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project LookLook by xinghongfei.

the class TopNewsDescribeActivity method initData.

protected void initData() {
    id = getIntent().getStringExtra("docid");
    title = getIntent().getStringExtra("title");
    mTextView.setText(title);
    mImageUrl = getIntent().getStringExtra("image");
    scrollListener = new NestedScrollView.OnScrollChangeListener() {

        @Override
        public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
            if (oldScrollY < 168) {
                mShot.setOffset(-oldScrollY);
                mTextView.setOffset(-oldScrollY);
            }
        }
    };
    Glide.with(this).load(mImageUrl).override(width, heigh).listener(glideLoadListener).centerCrop().diskCacheStrategy(DiskCacheStrategy.SOURCE).into(mShot);
    mTopNewsDesPresenter = new TopNewsDesPresenterImpl(this);
    mNest.setOnScrollChangeListener(scrollListener);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        postponeEnterTransition();
        mShot.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

            @Override
            public boolean onPreDraw() {
                mShot.getViewTreeObserver().removeOnPreDrawListener(this);
                startPostponedEnterTransition();
                return true;
            }
        });
    }
    mReturnHomeListener = new AnimUtils.TransitionListenerAdapter() {

        @Override
        public void onTransitionStart(Transition transition) {
            super.onTransitionStart(transition);
            // hide the fab as for some reason it jumps position??  TODO work out why
            mToolbar.animate().alpha(0f).setDuration(100).setInterpolator(new AccelerateInterpolator());
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                mShot.setElevation(1f);
                mToolbar.setElevation(0f);
            }
            mNest.animate().alpha(0f).setDuration(50).setInterpolator(new AccelerateInterpolator());
        }
    };
    mEnterTrasitionListener = new AnimUtils.TransitionListenerAdapter() {

        @Override
        public void onTransitionEnd(Transition transition) {
            super.onTransitionEnd(transition);
            //                    解决5.0 shara element bug
            ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 100).setDuration(100);
            valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                @Override
                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                    //                            mShot.setOffset((Integer) valueAnimator.getAnimatedValue() * 10);
                    mNest.smoothScrollTo((Integer) valueAnimator.getAnimatedValue() / 10, 0);
                }
            });
            valueAnimator.start();
        //                    mShot.setAlpha(0.5f);
        //                    mShot.animate().alpha(1f).setDuration(800L).start();
        }

        @Override
        public void onTransitionResume(Transition transition) {
            super.onTransitionResume(transition);
        }
    };
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ValueAnimator(android.animation.ValueAnimator) AnimUtils(com.looklook.xinghongfei.looklook.util.AnimUtils) Transition(android.transition.Transition) NestedScrollView(android.support.v4.widget.NestedScrollView) TopNewsDesPresenterImpl(com.looklook.xinghongfei.looklook.presenter.implPresenter.TopNewsDesPresenterImpl) ViewTreeObserver(android.view.ViewTreeObserver)

Example 20 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project LookLook by xinghongfei.

the class TopNewsDescribeActivity method expandImageAndFinish.

private void expandImageAndFinish() {
    if (mShot.getOffset() != 0f) {
        Animator expandImage = ObjectAnimator.ofFloat(mShot, ParallaxScrimageView.OFFSET, 0f);
        expandImage.setDuration(80);
        expandImage.setInterpolator(new AccelerateInterpolator());
        expandImage.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    finishAfterTransition();
                } else {
                    finish();
                }
            }
        });
        expandImage.start();
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            finishAfterTransition();
        } else {
            finish();
        }
    }
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Aggregations

AccelerateInterpolator (android.view.animation.AccelerateInterpolator)186 Animator (android.animation.Animator)62 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)54 View (android.view.View)52 ObjectAnimator (android.animation.ObjectAnimator)41 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)40 ImageView (android.widget.ImageView)26 AnimatorSet (android.animation.AnimatorSet)24 TextView (android.widget.TextView)23 Animation (android.view.animation.Animation)21 ValueAnimator (android.animation.ValueAnimator)17 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)14 LinearInterpolator (android.view.animation.LinearInterpolator)14 TranslateAnimation (android.view.animation.TranslateAnimation)14 OvershootInterpolator (android.view.animation.OvershootInterpolator)13 Point (android.graphics.Point)12 Paint (android.graphics.Paint)10 Interpolator (android.view.animation.Interpolator)9 AlphaAnimation (android.view.animation.AlphaAnimation)8 AnticipateOvershootInterpolator (android.view.animation.AnticipateOvershootInterpolator)8