Search in sources :

Example 6 with LinearInterpolator

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

the class ENVolumeView method onSizeChanged.

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    mWidth = w * 5 / 6;
    mHeight = h;
    mBaseLength = mWidth / 6;
    mCenterX = w / 2;
    mCenterY = h / 2;
    mPath.moveTo(mCenterX - 3 * mBaseLength, mCenterY);
    mPath.lineTo(mCenterX - 3 * mBaseLength, mCenterY - 0.5f * mBaseLength);
    mPath.lineTo(mCenterX - 2 * mBaseLength, mCenterY - 0.5f * mBaseLength);
    mPath.lineTo(mCenterX, mCenterY - 2 * mBaseLength);
    mPath.lineTo(mCenterX, mCenterY + 2 * mBaseLength);
    mPath.lineTo(mCenterX - 2 * mBaseLength, mCenterY + 0.5f * mBaseLength);
    mPath.lineTo(mCenterX - 3 * mBaseLength, mCenterY + 0.5f * mBaseLength);
    mPath.close();
    mPathMeasure.setPath(mPath, false);
    mPathLength = mPathMeasure.getLength();
    vibrateAnim = ValueAnimator.ofFloat(1.f, 100.f);
    vibrateAnim.setDuration(100);
    vibrateAnim.setInterpolator(new LinearInterpolator());
    vibrateAnim.setRepeatCount(ValueAnimator.INFINITE);
    vibrateAnim.setRepeatMode(ValueAnimator.REVERSE);
    vibrateAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
}
Also used : LinearInterpolator(android.view.animation.LinearInterpolator) ValueAnimator(android.animation.ValueAnimator)

Example 7 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project Launcher3 by chislon.

the class DeleteDropTarget method animateToTrashAndCompleteDrop.

private void animateToTrashAndCompleteDrop(final DragObject d) {
    final DragLayer dragLayer = mLauncher.getDragLayer();
    final Rect from = new Rect();
    dragLayer.getViewRectRelativeToSelf(d.dragView, from);
    final Rect to = getIconRect(d.dragView.getMeasuredWidth(), d.dragView.getMeasuredHeight(), mCurrentDrawable.getIntrinsicWidth(), mCurrentDrawable.getIntrinsicHeight());
    final float scale = (float) to.width() / from.width();
    mSearchDropTargetBar.deferOnDragEnd();
    deferCompleteDropIfUninstalling(d);
    Runnable onAnimationEndRunnable = new Runnable() {

        @Override
        public void run() {
            completeDrop(d);
            mSearchDropTargetBar.onDragEnd();
            mLauncher.exitSpringLoadedDragMode();
        }
    };
    dragLayer.animateView(d.dragView, from, to, scale, 1f, 1f, 0.1f, 0.1f, DELETE_ANIMATION_DURATION, new DecelerateInterpolator(2), new LinearInterpolator(), onAnimationEndRunnable, DragLayer.ANIMATION_END_DISAPPEAR, null);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Rect(android.graphics.Rect) LinearInterpolator(android.view.animation.LinearInterpolator)

Example 8 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project ArcMenu by daCapricorn.

the class ArcLayout method createShrinkAnimation.

private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, long startOffset, long duration, Interpolator interpolator) {
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.setFillAfter(true);
    final long preDuration = duration / 2;
    Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setStartOffset(startOffset);
    rotateAnimation.setDuration(preDuration);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setFillAfter(true);
    animationSet.addAnimation(rotateAnimation);
    Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
    translateAnimation.setStartOffset(startOffset + preDuration);
    translateAnimation.setDuration(duration - preDuration);
    translateAnimation.setInterpolator(interpolator);
    translateAnimation.setFillAfter(true);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) RotateAnimation(android.view.animation.RotateAnimation) Animation(android.view.animation.Animation) AnimationSet(android.view.animation.AnimationSet)

Example 9 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project LoadingDrawable by dinuscxj.

the class LoadingRenderer method setupAnimators.

private void setupAnimators() {
    mRenderAnimator = ValueAnimator.ofFloat(0.0f, 1.0f);
    mRenderAnimator.setRepeatCount(Animation.INFINITE);
    mRenderAnimator.setRepeatMode(Animation.RESTART);
    mRenderAnimator.setDuration(mDuration);
    //fuck you! the default interpolator is AccelerateDecelerateInterpolator
    mRenderAnimator.setInterpolator(new LinearInterpolator());
    mRenderAnimator.addUpdateListener(mAnimatorUpdateListener);
}
Also used : LinearInterpolator(android.view.animation.LinearInterpolator)

Example 10 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project RecyclerRefreshLayout by dinuscxj.

the class MaterialRefreshView method startAnimator.

private void startAnimator() {
    mRotateAnimator = ValueAnimator.ofFloat(0.0f, 1.0f);
    mRotateAnimator.setInterpolator(new LinearInterpolator());
    mRotateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float rotateProgress = (float) animation.getAnimatedValue();
            setStartDegrees(DEFAULT_START_DEGREES + rotateProgress * 360);
        }
    });
    mRotateAnimator.setRepeatMode(ValueAnimator.RESTART);
    mRotateAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mRotateAnimator.setDuration(ANIMATION_DURATION);
    mRotateAnimator.start();
}
Also used : LinearInterpolator(android.view.animation.LinearInterpolator) 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