Search in sources :

Example 1 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project UltimateAndroid by cymcsg.

the class CreditScrollDemoActivity method animateScroll.

private void animateScroll() {
    mScrolling = true;
    mScrollAnimator = ObjectAnimator.ofInt(mSeekBar, "progress", mSeekBar.getProgress(), mSeekBar.getMax());
    mScrollAnimator.setDuration((long) (SCROLL_ANIM_DURATION * (1 - (float) mSeekBar.getProgress() / mSeekBar.getMax())));
    mScrollAnimator.setInterpolator(new LinearInterpolator());
    mScrollAnimator.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        // Don't care
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mScrolling = false;
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        // Don't care
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        // Don't care
        }
    });
    mScrollAnimator.start();
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) LinearInterpolator(android.view.animation.LinearInterpolator)

Example 2 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project SmoothProgressBar by castorflex.

the class MakeCustomActivity method setInterpolator.

private void setInterpolator(int position) {
    switch(position) {
        case 1:
            mCurrentInterpolator = new LinearInterpolator();
            mSeekBarFactor.setEnabled(false);
            break;
        case 2:
            mCurrentInterpolator = new AccelerateDecelerateInterpolator();
            mSeekBarFactor.setEnabled(false);
            break;
        case 3:
            mCurrentInterpolator = new DecelerateInterpolator(mFactor);
            mSeekBarFactor.setEnabled(true);
            break;
        case 4:
            mCurrentInterpolator = new FastOutSlowInInterpolator();
            mSeekBarFactor.setEnabled(true);
            break;
        case 0:
        default:
            mCurrentInterpolator = new AccelerateInterpolator(mFactor);
            mSeekBarFactor.setEnabled(true);
            break;
    }
    mProgressBar.setSmoothProgressDrawableInterpolator(mCurrentInterpolator);
    mProgressBar.setSmoothProgressDrawableColors(getResources().getIntArray(R.array.gplus_colors));
    updateValues();
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator)

Example 3 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project cw-omnibus by commonsguy.

the class IcsProgressBar method startAnimation.

/**
     * <p>Start the indeterminate progress animation.</p>
     */
void startAnimation() {
    if (getVisibility() != VISIBLE) {
        return;
    }
    if (mIndeterminateDrawable instanceof Animatable) {
        mShouldStartAnimationDrawable = true;
        mAnimation = null;
    } else {
        if (mInterpolator == null) {
            mInterpolator = new LinearInterpolator();
        }
        mTransformation = new Transformation();
        mAnimation = new AlphaAnimation(0.0f, 1.0f);
        mAnimation.setRepeatMode(mBehavior);
        mAnimation.setRepeatCount(Animation.INFINITE);
        mAnimation.setDuration(mDuration);
        mAnimation.setInterpolator(mInterpolator);
        mAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    }
    postInvalidate();
}
Also used : Transformation(android.view.animation.Transformation) LinearInterpolator(android.view.animation.LinearInterpolator) Animatable(android.graphics.drawable.Animatable) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 4 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project ENViews by codeestX.

the class ENDownloadView method downloadAnim.

private void downloadAnim() {
    ValueAnimator downloadAnim = ValueAnimator.ofFloat(1.f, 100.f);
    downloadAnim.setDuration(mDownloadTime);
    downloadAnim.setInterpolator(new LinearInterpolator());
    downloadAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = valueAnimator.getAnimatedFraction();
            if (mUnit != DownloadUnit.NONE && mTotalSize > 0)
                mCurrentSize = mFraction * mTotalSize;
            invalidate();
        }
    });
    downloadAnim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mCurrentState = STATE_END;
            endAnim();
        }
    });
    downloadAnim.start();
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) LinearInterpolator(android.view.animation.LinearInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Example 5 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project ENViews by codeestX.

the class ENSearchView method start.

public void start() {
    if (mCurrentState == STATE_SEARCHING) {
        return;
    }
    mCurrentState = STATE_SEARCHING;
    ValueAnimator valueAnim = ValueAnimator.ofFloat(1.f, 100.f);
    valueAnim.setDuration(mDuration);
    valueAnim.setInterpolator(new LinearInterpolator());
    valueAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
    valueAnim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mCurrentState = STATE_WAIT;
        }
    });
    valueAnim.start();
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) LinearInterpolator(android.view.animation.LinearInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Aggregations

LinearInterpolator (android.view.animation.LinearInterpolator)209 ValueAnimator (android.animation.ValueAnimator)59 Animator (android.animation.Animator)42 ObjectAnimator (android.animation.ObjectAnimator)40 Paint (android.graphics.Paint)30 ArrayList (java.util.ArrayList)28 AlphaAnimation (android.view.animation.AlphaAnimation)27 RotateAnimation (android.view.animation.RotateAnimation)24 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)22 PropertyValuesHolder (android.animation.PropertyValuesHolder)18 Animatable (android.graphics.drawable.Animatable)17 Animation (android.view.animation.Animation)17 Transformation (android.view.animation.Transformation)17 View (android.view.View)16 AnimatorSet (android.animation.AnimatorSet)15 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)14 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)12 TranslateAnimation (android.view.animation.TranslateAnimation)12 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)9 AnimationListener (android.view.animation.Animation.AnimationListener)8