Search in sources :

Example 91 with AccelerateDecelerateInterpolator

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

the class MainActivity method animateParallel.

protected void animateParallel() {
    final ViewAnimator viewAnimator = ViewAnimator.animate(mountain, image).dp().translationY(-1000, 0).alpha(0, 1).singleInterpolator(new OvershootInterpolator()).andAnimate(percent).scale(0, 1).andAnimate(text).textColor(Color.BLACK, Color.WHITE).backgroundColor(Color.WHITE, Color.BLACK).waitForHeight().singleInterpolator(new AccelerateDecelerateInterpolator()).duration(2000).thenAnimate(percent).custom(new AnimationListener.Update<TextView>() {

        @Override
        public void update(TextView view, float value) {
            view.setText(String.format(Locale.US, "%.02f%%", value));
        }
    }, 0, 1).andAnimate(image).rotation(0, 360).duration(5000).start();
    new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {

        @Override
        public void run() {
            viewAnimator.cancel();
        }
    }, 3000);
}
Also used : ViewAnimator(com.github.florent37.viewanimator.ViewAnimator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) Handler(android.os.Handler) TextView(android.widget.TextView) AnimationListener(com.github.florent37.viewanimator.AnimationListener)

Example 92 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project HTextView by hanks-zyh.

the class FallText method animateStart.

@Override
protected void animateStart(CharSequence text) {
    int n = mText.length();
    n = n <= 0 ? 1 : n;
    long duration = (long) (charTime + charTime / mostCount * (n - 1));
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, duration).setDuration(duration);
    valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            progress = (float) animation.getAnimatedValue();
            mHTextView.invalidate();
        }
    });
    valueAnimator.start();
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ValueAnimator(android.animation.ValueAnimator) Paint(android.graphics.Paint)

Example 93 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project HTextView by hanks-zyh.

the class PixelateText method animateText.

@Override
public void animateText(CharSequence text) {
    mOldText = mText;
    mText = text;
    calc();
    int n = mText.length();
    n = n <= 0 ? 1 : n;
    long duration = (long) (charTime + charTime / mostCount * (n - 1));
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, duration).setDuration(duration);
    valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            progress = (float) animation.getAnimatedValue();
            mHTextView.invalidate();
        }
    });
    valueAnimator.start();
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ValueAnimator(android.animation.ValueAnimator) Paint(android.graphics.Paint)

Example 94 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project FolderLayout by kyze8439690.

the class FolderLayout method playExpandItemAnimation.

private void playExpandItemAnimation(final View child) {
    final LayoutParams p = (LayoutParams) child.getLayoutParams();
    TranslateAnimation animation = new TranslateAnimation(0, 0, 0, p.shrinkTop - child.getTop());
    animation.setInterpolator(new AccelerateDecelerateInterpolator());
    animation.setDuration(mDuration);
    animation.setFillAfter(true);
    animation.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            child.offsetTopAndBottom(p.shrinkTop - child.getTop());
            child.clearAnimation();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    child.startAnimation(animation);
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation)

Example 95 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project Android-ObservableScrollView by ksoichiro.

the class FillGap3BaseActivity method changeHeaderBackgroundHeightAnimated.

private void changeHeaderBackgroundHeightAnimated(boolean shouldShowGap, boolean animated) {
    if (mGapIsChanging) {
        return;
    }
    final int heightOnGapShown = mHeaderBar.getHeight();
    final int heightOnGapHidden = mHeaderBar.getHeight() + mActionBarSize;
    final float from = mHeaderBackground.getLayoutParams().height;
    final float to;
    if (shouldShowGap) {
        if (!mGapHidden) {
            // Already shown
            return;
        }
        to = heightOnGapShown;
    } else {
        if (mGapHidden) {
            // Already hidden
            return;
        }
        to = heightOnGapHidden;
    }
    if (animated) {
        ViewPropertyAnimator.animate(mHeaderBackground).cancel();
        ValueAnimator a = ValueAnimator.ofFloat(from, to);
        a.setDuration(100);
        a.setInterpolator(new AccelerateDecelerateInterpolator());
        a.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float height = (float) animation.getAnimatedValue();
                changeHeaderBackgroundHeight(height, to, heightOnGapHidden);
            }
        });
        a.start();
    } else {
        changeHeaderBackgroundHeight(to, to, heightOnGapHidden);
    }
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Aggregations

AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)165 ValueAnimator (android.animation.ValueAnimator)38 ObjectAnimator (android.animation.ObjectAnimator)31 Animator (android.animation.Animator)30 View (android.view.View)30 AnimatorSet (android.animation.AnimatorSet)22 Animation (android.view.animation.Animation)19 Handler (android.os.Handler)15 NonNull (android.support.annotation.NonNull)12 TranslateAnimation (android.view.animation.TranslateAnimation)12 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)11 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)10 AlphaAnimation (android.view.animation.AlphaAnimation)10 ImageView (android.widget.ImageView)10 TextView (android.widget.TextView)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