Search in sources :

Example 56 with ObjectAnimator

use of android.animation.ObjectAnimator in project TransitionPlayer by linfaxin.

the class AnimatorUtils method splitAnimatorByValues.

public static List<ValueAnimator> splitAnimatorByValues(ValueAnimator animator) {
    ArrayList<ValueAnimator> animators = new ArrayList<>();
    PropertyValuesHolder[] valuesHolders = animator.getValues();
    if (valuesHolders != null && valuesHolders.length > 0) {
        for (PropertyValuesHolder valuesHolder : valuesHolders) {
            ValueAnimator clone = animator.clone();
            if (clone instanceof ObjectAnimator) {
                ((ObjectAnimator) clone).setPropertyName(valuesHolder.getPropertyName());
            }
            clone.setValues(valuesHolder);
            animators.add(clone);
        }
    } else {
        animators.add(animator);
    }
    return animators;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) ArrayList(java.util.ArrayList) PropertyValuesHolder(android.animation.PropertyValuesHolder) ValueAnimator(android.animation.ValueAnimator)

Example 57 with ObjectAnimator

use of android.animation.ObjectAnimator in project InstaMaterial by frogermcs.

the class TakePhotoActivity method animateShutter.

private void animateShutter() {
    vShutter.setVisibility(View.VISIBLE);
    vShutter.setAlpha(0.f);
    ObjectAnimator alphaInAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0f, 0.8f);
    alphaInAnim.setDuration(100);
    alphaInAnim.setStartDelay(100);
    alphaInAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
    ObjectAnimator alphaOutAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0.8f, 0f);
    alphaOutAnim.setDuration(200);
    alphaOutAnim.setInterpolator(DECELERATE_INTERPOLATOR);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playSequentially(alphaInAnim, alphaOutAnim);
    animatorSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            vShutter.setVisibility(View.GONE);
        }
    });
    animatorSet.start();
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnimatorSet(android.animation.AnimatorSet)

Example 58 with ObjectAnimator

use of android.animation.ObjectAnimator in project InstaMaterial by frogermcs.

the class FeedItemAnimator method animatePhotoLike.

private void animatePhotoLike(final FeedAdapter.CellFeedViewHolder holder) {
    holder.vBgLike.setVisibility(View.VISIBLE);
    holder.ivLike.setVisibility(View.VISIBLE);
    holder.vBgLike.setScaleY(0.1f);
    holder.vBgLike.setScaleX(0.1f);
    holder.vBgLike.setAlpha(1f);
    holder.ivLike.setScaleY(0.1f);
    holder.ivLike.setScaleX(0.1f);
    AnimatorSet animatorSet = new AnimatorSet();
    ObjectAnimator bgScaleYAnim = ObjectAnimator.ofFloat(holder.vBgLike, "scaleY", 0.1f, 1f);
    bgScaleYAnim.setDuration(200);
    bgScaleYAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
    ObjectAnimator bgScaleXAnim = ObjectAnimator.ofFloat(holder.vBgLike, "scaleX", 0.1f, 1f);
    bgScaleXAnim.setDuration(200);
    bgScaleXAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
    ObjectAnimator bgAlphaAnim = ObjectAnimator.ofFloat(holder.vBgLike, "alpha", 1f, 0f);
    bgAlphaAnim.setDuration(200);
    bgAlphaAnim.setStartDelay(150);
    bgAlphaAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
    ObjectAnimator imgScaleUpYAnim = ObjectAnimator.ofFloat(holder.ivLike, "scaleY", 0.1f, 1f);
    imgScaleUpYAnim.setDuration(300);
    imgScaleUpYAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
    ObjectAnimator imgScaleUpXAnim = ObjectAnimator.ofFloat(holder.ivLike, "scaleX", 0.1f, 1f);
    imgScaleUpXAnim.setDuration(300);
    imgScaleUpXAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
    ObjectAnimator imgScaleDownYAnim = ObjectAnimator.ofFloat(holder.ivLike, "scaleY", 1f, 0f);
    imgScaleDownYAnim.setDuration(300);
    imgScaleDownYAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
    ObjectAnimator imgScaleDownXAnim = ObjectAnimator.ofFloat(holder.ivLike, "scaleX", 1f, 0f);
    imgScaleDownXAnim.setDuration(300);
    imgScaleDownXAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
    animatorSet.playTogether(bgScaleYAnim, bgScaleXAnim, bgAlphaAnim, imgScaleUpYAnim, imgScaleUpXAnim);
    animatorSet.play(imgScaleDownYAnim).with(imgScaleDownXAnim).after(imgScaleUpYAnim);
    animatorSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            likeAnimationsMap.remove(holder);
            resetLikeAnimationState(holder);
            dispatchChangeFinishedIfAllAnimationsEnded(holder);
        }
    });
    animatorSet.start();
    likeAnimationsMap.put(holder, animatorSet);
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnimatorSet(android.animation.AnimatorSet)

Example 59 with ObjectAnimator

use of android.animation.ObjectAnimator in project LikeAnimation by frogermcs.

the class LikeButtonView method onClick.

@Override
public void onClick(View v) {
    isChecked = !isChecked;
    ivStar.setImageResource(isChecked ? R.drawable.ic_star_rate_on : R.drawable.ic_star_rate_off);
    if (animatorSet != null) {
        animatorSet.cancel();
    }
    if (isChecked) {
        ivStar.animate().cancel();
        ivStar.setScaleX(0);
        ivStar.setScaleY(0);
        vCircle.setInnerCircleRadiusProgress(0);
        vCircle.setOuterCircleRadiusProgress(0);
        vDotsView.setCurrentProgress(0);
        animatorSet = new AnimatorSet();
        ObjectAnimator outerCircleAnimator = ObjectAnimator.ofFloat(vCircle, CircleView.OUTER_CIRCLE_RADIUS_PROGRESS, 0.1f, 1f);
        outerCircleAnimator.setDuration(250);
        outerCircleAnimator.setInterpolator(DECCELERATE_INTERPOLATOR);
        ObjectAnimator innerCircleAnimator = ObjectAnimator.ofFloat(vCircle, CircleView.INNER_CIRCLE_RADIUS_PROGRESS, 0.1f, 1f);
        innerCircleAnimator.setDuration(200);
        innerCircleAnimator.setStartDelay(200);
        innerCircleAnimator.setInterpolator(DECCELERATE_INTERPOLATOR);
        ObjectAnimator starScaleYAnimator = ObjectAnimator.ofFloat(ivStar, ImageView.SCALE_Y, 0.2f, 1f);
        starScaleYAnimator.setDuration(350);
        starScaleYAnimator.setStartDelay(250);
        starScaleYAnimator.setInterpolator(OVERSHOOT_INTERPOLATOR);
        ObjectAnimator starScaleXAnimator = ObjectAnimator.ofFloat(ivStar, ImageView.SCALE_X, 0.2f, 1f);
        starScaleXAnimator.setDuration(350);
        starScaleXAnimator.setStartDelay(250);
        starScaleXAnimator.setInterpolator(OVERSHOOT_INTERPOLATOR);
        ObjectAnimator dotsAnimator = ObjectAnimator.ofFloat(vDotsView, DotsView.DOTS_PROGRESS, 0, 1f);
        dotsAnimator.setDuration(900);
        dotsAnimator.setStartDelay(50);
        dotsAnimator.setInterpolator(ACCELERATE_DECELERATE_INTERPOLATOR);
        animatorSet.playTogether(outerCircleAnimator, innerCircleAnimator, starScaleYAnimator, starScaleXAnimator, dotsAnimator);
        animatorSet.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationCancel(Animator animation) {
                vCircle.setInnerCircleRadiusProgress(0);
                vCircle.setOuterCircleRadiusProgress(0);
                vDotsView.setCurrentProgress(0);
                ivStar.setScaleX(1);
                ivStar.setScaleY(1);
            }
        });
        animatorSet.start();
    }
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnimatorSet(android.animation.AnimatorSet)

Example 60 with ObjectAnimator

use of android.animation.ObjectAnimator in project PaymentKit-Droid by brendanw.

the class CardIcon method flipToBack.

private void flipToBack() {
    ViewUtils.setHardwareLayer(mFrontFace);
    ObjectAnimator rotateFront = ObjectAnimator.ofFloat(mFrontFace, "scaleX", 1.0f, 0.0f);
    rotateFront.setDuration(HALF_FLIP_DURATION);
    ViewUtils.setHardwareLayer(mBackFace);
    final ObjectAnimator rotateBack = ObjectAnimator.ofFloat(mBackFace, "scaleX", 0.0f, 1.0f);
    rotateBack.setDuration(HALF_FLIP_DURATION);
    rotateBack.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator anim) {
            ViewUtils.setLayerTypeNone(mBackFace);
        }
    });
    rotateFront.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator anim) {
            alphaOut(mFrontFace);
            ViewUtils.setLayerTypeNone(mFrontFace);
            alphaIn(mBackFace);
            rotateBack.start();
        }
    });
    rotateFront.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Aggregations

ObjectAnimator (android.animation.ObjectAnimator)791 Animator (android.animation.Animator)313 AnimatorSet (android.animation.AnimatorSet)214 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)208 PropertyValuesHolder (android.animation.PropertyValuesHolder)128 ValueAnimator (android.animation.ValueAnimator)111 View (android.view.View)102 Paint (android.graphics.Paint)68 TextView (android.widget.TextView)49 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)48 ViewGroup (android.view.ViewGroup)45 Rect (android.graphics.Rect)35 LinearInterpolator (android.view.animation.LinearInterpolator)35 ImageView (android.widget.ImageView)31 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)30 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)29 OvershootInterpolator (android.view.animation.OvershootInterpolator)29 ArrayList (java.util.ArrayList)22 TargetApi (android.annotation.TargetApi)21 Interpolator (android.view.animation.Interpolator)20