Search in sources :

Example 56 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project PhotoNoter by yydcdut.

the class ZoomHeaderImageView method doAnimation.

private void doAnimation() {
    AnimatorSet animatorSet = new AnimatorSet();
    if (mCurrentIndex % 2 == 0) {
        animatorSet.playTogether(ObjectAnimator.ofFloat(mImageView0, "scaleX", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView0, "scaleY", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView0, "alpha", 1f, 0.0f), ObjectAnimator.ofFloat(mImageView1, "scaleX", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView1, "scaleY", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView1, "alpha", 0.0f, 1.0f));
    } else {
        animatorSet.playTogether(ObjectAnimator.ofFloat(mImageView1, "scaleX", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView1, "scaleY", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView1, "alpha", 1f, 0.0f), ObjectAnimator.ofFloat(mImageView0, "scaleX", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView0, "scaleY", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView0, "alpha", 0.0f, 1.0f));
    }
    animatorSet.setDuration(400).addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            mImageView0.setVisibility(VISIBLE);
            mImageView1.setVisibility(VISIBLE);
            if (mCurrentIndex % 2 == 0) {
                mImageView1.setImageResource(mResArray[(mCurrentIndex + 1) % 5]);
            } else {
                mImageView0.setImageResource(mResArray[(mCurrentIndex + 1) % 5]);
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mCurrentIndex++;
            if (mCurrentIndex % 2 == 0) {
                mImageView1.setVisibility(INVISIBLE);
            } else {
                mImageView0.setVisibility(INVISIBLE);
            }
            mHandler.sendEmptyMessageDelayed(0, 3000);
        }
    });
    animatorSet.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 57 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project android-shapeLoadingView by zzz40500.

the class LoadingView method freeFall.

/**
     * 下落
     */
public void freeFall() {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mShapeLoadingView, "translationY", 0, mDistance);
    ObjectAnimator scaleIndication = ObjectAnimator.ofFloat(mIndicationIm, "scaleX", 1, 0.2f);
    objectAnimator.setDuration(ANIMATION_DURATION);
    objectAnimator.setInterpolator(new AccelerateInterpolator(factor));
    mDownAnimatorSet = new AnimatorSet();
    mDownAnimatorSet.setDuration(ANIMATION_DURATION);
    mDownAnimatorSet.playTogether(objectAnimator, scaleIndication);
    mDownAnimatorSet.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mShapeLoadingView.changeShape();
            upThrow();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    mDownAnimatorSet.start();
}
Also used : Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Aggregations

AnimatorSet (com.nineoldandroids.animation.AnimatorSet)57 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)42 Animator (com.nineoldandroids.animation.Animator)24 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)11 View (android.view.View)6 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)4 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)4 SuppressLint (android.annotation.SuppressLint)3 Paint (android.graphics.Paint)3 OvershootInterpolator (android.view.animation.OvershootInterpolator)3 Point (android.graphics.Point)2 DisplayMetrics (android.util.DisplayMetrics)2 LinearInterpolator (android.view.animation.LinearInterpolator)2 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)2 IDetailView (com.yydcdut.note.views.note.IDetailView)2 FontTextView (com.yydcdut.note.widget.FontTextView)2 RevealView (com.yydcdut.note.widget.RevealView)2