Search in sources :

Example 26 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project PageIndicatorView by romandanylyk.

the class WormAnimation method createAnimator.

@NonNull
@Override
public AnimatorSet createAnimator() {
    AnimatorSet animator = new AnimatorSet();
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    return animator;
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet) NonNull(android.support.annotation.NonNull)

Example 27 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project Material-Movies by saulmm.

the class GUIUtils method startScaleAnimationFromPivot.

public static void startScaleAnimationFromPivot(int pivotX, int pivotY, final View v, final AnimatorListener animatorListener) {
    final AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator();
    v.setScaleY(SCALE_START_ANCHOR);
    v.setPivotX(pivotX);
    v.setPivotY(pivotY);
    v.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

        @Override
        public boolean onPreDraw() {
            v.getViewTreeObserver().removeOnPreDrawListener(this);
            ViewPropertyAnimator viewPropertyAnimator = v.animate().setInterpolator(interpolator).scaleY(1).scaleX(1).setDuration(SCALE_DELAY);
            if (animatorListener != null)
                viewPropertyAnimator.setListener(animatorListener);
            viewPropertyAnimator.start();
            return true;
        }
    });
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ViewTreeObserver(android.view.ViewTreeObserver) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 28 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project android-ripple-background by skyfishjy.

the class RippleBackground method init.

private void init(final Context context, final AttributeSet attrs) {
    if (isInEditMode())
        return;
    if (null == attrs) {
        throw new IllegalArgumentException("Attributes should be provided to this view,");
    }
    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleBackground);
    rippleColor = typedArray.getColor(R.styleable.RippleBackground_rb_color, getResources().getColor(R.color.rippelColor));
    rippleStrokeWidth = typedArray.getDimension(R.styleable.RippleBackground_rb_strokeWidth, getResources().getDimension(R.dimen.rippleStrokeWidth));
    rippleRadius = typedArray.getDimension(R.styleable.RippleBackground_rb_radius, getResources().getDimension(R.dimen.rippleRadius));
    rippleDurationTime = typedArray.getInt(R.styleable.RippleBackground_rb_duration, DEFAULT_DURATION_TIME);
    rippleAmount = typedArray.getInt(R.styleable.RippleBackground_rb_rippleAmount, DEFAULT_RIPPLE_COUNT);
    rippleScale = typedArray.getFloat(R.styleable.RippleBackground_rb_scale, DEFAULT_SCALE);
    rippleType = typedArray.getInt(R.styleable.RippleBackground_rb_type, DEFAULT_FILL_TYPE);
    typedArray.recycle();
    rippleDelay = rippleDurationTime / rippleAmount;
    paint = new Paint();
    paint.setAntiAlias(true);
    if (rippleType == DEFAULT_FILL_TYPE) {
        rippleStrokeWidth = 0;
        paint.setStyle(Paint.Style.FILL);
    } else
        paint.setStyle(Paint.Style.STROKE);
    paint.setColor(rippleColor);
    rippleParams = new LayoutParams((int) (2 * (rippleRadius + rippleStrokeWidth)), (int) (2 * (rippleRadius + rippleStrokeWidth)));
    rippleParams.addRule(CENTER_IN_PARENT, TRUE);
    animatorSet = new AnimatorSet();
    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorList = new ArrayList<Animator>();
    for (int i = 0; i < rippleAmount; i++) {
        RippleView rippleView = new RippleView(getContext());
        addView(rippleView, rippleParams);
        rippleViewList.add(rippleView);
        final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleX", 1.0f, rippleScale);
        scaleXAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        scaleXAnimator.setRepeatMode(ObjectAnimator.RESTART);
        scaleXAnimator.setStartDelay(i * rippleDelay);
        scaleXAnimator.setDuration(rippleDurationTime);
        animatorList.add(scaleXAnimator);
        final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleY", 1.0f, rippleScale);
        scaleYAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        scaleYAnimator.setRepeatMode(ObjectAnimator.RESTART);
        scaleYAnimator.setStartDelay(i * rippleDelay);
        scaleYAnimator.setDuration(rippleDurationTime);
        animatorList.add(scaleYAnimator);
        final ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(rippleView, "Alpha", 1.0f, 0f);
        alphaAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        alphaAnimator.setRepeatMode(ObjectAnimator.RESTART);
        alphaAnimator.setStartDelay(i * rippleDelay);
        alphaAnimator.setDuration(rippleDurationTime);
        animatorList.add(alphaAnimator);
    }
    animatorSet.playTogether(animatorList);
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) TypedArray(android.content.res.TypedArray) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet) Paint(android.graphics.Paint) Paint(android.graphics.Paint)

Example 29 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project android-ripple-background by skyfishjy.

the class MainActivity method foundDevice.

private void foundDevice() {
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(400);
    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    ArrayList<Animator> animatorList = new ArrayList<Animator>();
    ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(foundDevice, "ScaleX", 0f, 1.2f, 1f);
    animatorList.add(scaleXAnimator);
    ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(foundDevice, "ScaleY", 0f, 1.2f, 1f);
    animatorList.add(scaleYAnimator);
    animatorSet.playTogether(animatorList);
    foundDevice.setVisibility(View.VISIBLE);
    animatorSet.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ArrayList(java.util.ArrayList) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet)

Example 30 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project Reachability by sakebook.

the class Reachability method slideOut.

private void slideOut() {
    ObjectAnimator animator = ObjectAnimator.ofFloat(getHoverView(), "translationY", 0f, 300f);
    animator.setDuration(DURATION_TIME);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.addListener(mHoverListener);
    animator.start();
    mHoverListener.setShowStatus(false);
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator)

Aggregations

AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)152 ObjectAnimator (android.animation.ObjectAnimator)30 ValueAnimator (android.animation.ValueAnimator)30 Animator (android.animation.Animator)28 View (android.view.View)28 AnimatorSet (android.animation.AnimatorSet)19 Animation (android.view.animation.Animation)19 Handler (android.os.Handler)14 TranslateAnimation (android.view.animation.TranslateAnimation)12 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)10 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)10 AlphaAnimation (android.view.animation.AlphaAnimation)10 ImageView (android.widget.ImageView)10 Paint (android.graphics.Paint)9 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)9 LinearInterpolator (android.view.animation.LinearInterpolator)9 ScaleAnimation (android.view.animation.ScaleAnimation)9 PropertyValuesHolder (android.animation.PropertyValuesHolder)8 TextView (android.widget.TextView)8 Point (android.graphics.Point)7