Search in sources :

Example 66 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project ChipsLayoutManager by BelooS.

the class VerticalScrollingController method createSmoothScroller.

@Override
public RecyclerView.SmoothScroller createSmoothScroller(@NonNull Context context, final int position, final int timeMs, final AnchorViewState anchor) {
    return new LinearSmoothScroller(context) {

        /*
             * LinearSmoothScroller, at a minimum, just need to know the vector
             * (x/y distance) to travel in order to get from the current positioning
             * to the target.
             */
        @Override
        public PointF computeScrollVectorForPosition(int targetPosition) {
            int visiblePosition = anchor.getPosition();
            //determine scroll up or scroll down needed
            return new PointF(0, position > visiblePosition ? 1 : -1);
        }

        @Override
        protected void onTargetFound(View targetView, RecyclerView.State state, Action action) {
            super.onTargetFound(targetView, state, action);
            int desiredTop = lm.getPaddingTop();
            int currentTop = lm.getDecoratedTop(targetView);
            int dy = currentTop - desiredTop;
            //perform fit animation to move target view at top of layout
            action.update(0, dy, timeMs, new LinearInterpolator());
        }
    };
}
Also used : LinearInterpolator(android.view.animation.LinearInterpolator) AnchorViewState(com.beloo.widget.chipslayoutmanager.anchor.AnchorViewState) PointF(android.graphics.PointF) LinearSmoothScroller(android.support.v7.widget.LinearSmoothScroller) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 67 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project GSYVideoPlayer by CarGuo.

the class ENDownloadView method downloadAnim.

private void downloadAnim() {
    if (mValueAnimator != null) {
        mValueAnimator.removeAllListeners();
        mValueAnimator.removeAllUpdateListeners();
        if (mValueAnimator.isRunning())
            mValueAnimator.cancel();
        mValueAnimator = null;
    }
    if (mCurrentState != STATE_DOWNLOADING) {
        return;
    }
    mValueAnimator = ValueAnimator.ofFloat(1.f, 100.f);
    mValueAnimator.setDuration(mDownloadTime);
    mValueAnimator.setInterpolator(new LinearInterpolator());
    mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

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

        @Override
        public void onAnimationEnd(Animator animation) {
            mCurrentState = STATE_DOWNLOADING;
            downloadAnim();
        }
    });
    mValueAnimator.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 68 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project bilibili-android-client by HotBitmapGG.

the class LoveLikeLayout method getEnterAnimtorSet.

/**
   * 爱心的显示动画实现
   */
private AnimatorSet getEnterAnimtorSet(View target) {
    //爱心的3中动画组合 透明度 x,y轴的缩放
    ObjectAnimator alpha = ObjectAnimator.ofFloat(target, View.ALPHA, 0.2f, 1f);
    ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, 0.2f, 1f);
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, 0.2f, 1f);
    //组合动画
    AnimatorSet set = new AnimatorSet();
    set.setDuration(500);
    set.setInterpolator(new LinearInterpolator());
    set.playTogether(alpha, scaleX, scaleY);
    set.setTarget(target);
    return set;
}
Also used : LinearInterpolator(android.view.animation.LinearInterpolator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorSet(android.animation.AnimatorSet)

Example 69 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project ActionBarSherlock by JakeWharton.

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 70 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project AndroidChromium by JackyAndroid.

the class ToolbarPhone method createEnterTabSwitcherModeAnimation.

private ObjectAnimator createEnterTabSwitcherModeAnimation() {
    ObjectAnimator enterAnimation = ObjectAnimator.ofFloat(this, mTabSwitcherModePercentProperty, 1.f);
    enterAnimation.setDuration(TAB_SWITCHER_MODE_ENTER_ANIMATION_DURATION_MS);
    enterAnimation.setInterpolator(new LinearInterpolator());
    enterAnimation.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            // render and only a layout triggers a refresh.  See crbug.com/306890.
            if (!mToggleTabStackButton.isEnabled())
                requestLayout();
        }
    });
    return enterAnimation;
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) LinearInterpolator(android.view.animation.LinearInterpolator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Aggregations

LinearInterpolator (android.view.animation.LinearInterpolator)217 ValueAnimator (android.animation.ValueAnimator)65 Animator (android.animation.Animator)42 ObjectAnimator (android.animation.ObjectAnimator)39 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 View (android.view.View)17 Animation (android.view.animation.Animation)17 Transformation (android.view.animation.Transformation)17 AnimatorSet (android.animation.AnimatorSet)14 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)14 TranslateAnimation (android.view.animation.TranslateAnimation)12 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)11 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)9 AnimationListener (android.view.animation.Animation.AnimationListener)8