Search in sources :

Example 16 with ObjectAnimator

use of android.animation.ObjectAnimator in project Depth-LIB-Android- by danielzeller.

the class RootActivity method fadeColoTo.

private void fadeColoTo(int newColor, TextView view) {
    ObjectAnimator color = ObjectAnimator.ofObject(view, "TextColor", new ArgbEvaluator(), view.getCurrentTextColor(), newColor);
    color.setDuration(200);
    color.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) ArgbEvaluator(android.animation.ArgbEvaluator)

Example 17 with ObjectAnimator

use of android.animation.ObjectAnimator in project MaterialShowcaseView by deano2390.

the class AnimationFactory method fadeOutView.

@Override
public void fadeOutView(View target, long duration, final AnimationEndListener listener) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(target, ALPHA, INVISIBLE);
    oa.setDuration(duration).addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            listener.onAnimationEnd();
        }

        @Override
        public void onAnimationCancel(Animator animator) {
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    oa.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator)

Example 18 with ObjectAnimator

use of android.animation.ObjectAnimator in project circular-progress-button by dmytrodanylyk.

the class MorphingAnimation method start.

public void start() {
    ValueAnimator widthAnimation = ValueAnimator.ofInt(mFromWidth, mToWidth);
    final GradientDrawable gradientDrawable = mDrawable.getGradientDrawable();
    widthAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Integer value = (Integer) animation.getAnimatedValue();
            int leftOffset;
            int rightOffset;
            int padding;
            if (mFromWidth > mToWidth) {
                leftOffset = (mFromWidth - value) / 2;
                rightOffset = mFromWidth - leftOffset;
                padding = (int) (mPadding * animation.getAnimatedFraction());
            } else {
                leftOffset = (mToWidth - value) / 2;
                rightOffset = mToWidth - leftOffset;
                padding = (int) (mPadding - mPadding * animation.getAnimatedFraction());
            }
            gradientDrawable.setBounds(leftOffset + padding, padding, rightOffset - padding, mView.getHeight() - padding);
        }
    });
    ObjectAnimator bgColorAnimation = ObjectAnimator.ofInt(gradientDrawable, "color", mFromColor, mToColor);
    bgColorAnimation.setEvaluator(new ArgbEvaluator());
    ObjectAnimator strokeColorAnimation = ObjectAnimator.ofInt(mDrawable, "strokeColor", mFromStrokeColor, mToStrokeColor);
    strokeColorAnimation.setEvaluator(new ArgbEvaluator());
    ObjectAnimator cornerAnimation = ObjectAnimator.ofFloat(gradientDrawable, "cornerRadius", mFromCornerRadius, mToCornerRadius);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(mDuration);
    animatorSet.playTogether(widthAnimation, bgColorAnimation, strokeColorAnimation, cornerAnimation);
    animatorSet.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mListener != null) {
                mListener.onAnimationEnd();
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    animatorSet.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) ObjectAnimator(android.animation.ObjectAnimator) ArgbEvaluator(android.animation.ArgbEvaluator) AnimatorSet(android.animation.AnimatorSet) ValueAnimator(android.animation.ValueAnimator) GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 19 with ObjectAnimator

use of android.animation.ObjectAnimator in project UltimateAndroid by cymcsg.

the class MenuCircleShowingAnimation method closePromotedActions.

/**
     * Set close animation for promoted actions
     */
public AnimatorSet closePromotedActions() {
    if (objectAnimator == null) {
        objectAnimatorSetup();
    }
    AnimatorSet animation = new AnimatorSet();
    for (int i = 0; i < promotedActions.size(); i++) {
        objectAnimator[i] = setCloseAnimation(promotedActions.get(i), i);
    }
    if (objectAnimator.length == 0) {
        objectAnimator = null;
    }
    animation.playTogether(objectAnimator);
    animation.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
            mainImageButton.startAnimation(rotateCloseAnimation);
            mainImageButton.setClickable(false);
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            mainImageButton.setClickable(true);
            hidePromotedActions();
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            mainImageButton.setClickable(true);
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    return animation;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) AnimatorSet(android.animation.AnimatorSet)

Example 20 with ObjectAnimator

use of android.animation.ObjectAnimator in project UltimateAndroid by cymcsg.

the class MenuCircleShowingAnimation method openPromotedActions.

public AnimatorSet openPromotedActions() {
    if (objectAnimator == null) {
        objectAnimatorSetup();
    }
    AnimatorSet animation = new AnimatorSet();
    for (int i = 0; i < promotedActions.size(); i++) {
        objectAnimator[i] = setOpenAnimation(promotedActions.get(i), i);
    }
    if (objectAnimator.length == 0) {
        objectAnimator = null;
    }
    animation.playTogether(objectAnimator);
    animation.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
            mainImageButton.startAnimation(rotateOpenAnimation);
            mainImageButton.setClickable(false);
            showPromotedActions();
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            mainImageButton.setClickable(true);
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            mainImageButton.setClickable(true);
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    return animation;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) AnimatorSet(android.animation.AnimatorSet)

Aggregations

ObjectAnimator (android.animation.ObjectAnimator)767 Animator (android.animation.Animator)304 AnimatorSet (android.animation.AnimatorSet)209 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)202 PropertyValuesHolder (android.animation.PropertyValuesHolder)125 ValueAnimator (android.animation.ValueAnimator)111 View (android.view.View)99 Paint (android.graphics.Paint)68 TextView (android.widget.TextView)47 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)46 ViewGroup (android.view.ViewGroup)45 LinearInterpolator (android.view.animation.LinearInterpolator)36 Rect (android.graphics.Rect)34 ImageView (android.widget.ImageView)31 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)30 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)28 OvershootInterpolator (android.view.animation.OvershootInterpolator)27 ArrayList (java.util.ArrayList)21 Interpolator (android.view.animation.Interpolator)20 TargetApi (android.annotation.TargetApi)19