Java 类android.animation.FloatArrayEvaluator 实例源码

项目:LaunchEnr    文件:DragView.java   
private void animateFilterTo(float[] targetFilter) {
    float[] oldFilter = mCurrentFilter == null ? new ColorMatrix().getArray() : mCurrentFilter;
    mCurrentFilter = Arrays.copyOf(oldFilter, oldFilter.length);

    if (mFilterAnimator != null) {
        mFilterAnimator.cancel();
    }
    mFilterAnimator = ValueAnimator.ofObject(new FloatArrayEvaluator(mCurrentFilter),
            oldFilter, targetFilter);
    mFilterAnimator.setDuration(COLOR_CHANGE_DURATION);
    mFilterAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mPaint.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
            invalidate();
        }
    });
    mFilterAnimator.start();
}
项目:FlickLauncher    文件:DragView.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateFilterTo(float[] targetFilter) {
    float[] oldFilter = mCurrentFilter == null ? new ColorMatrix().getArray() : mCurrentFilter;
    mCurrentFilter = Arrays.copyOf(oldFilter, oldFilter.length);

    if (mFilterAnimator != null) {
        mFilterAnimator.cancel();
    }
    mFilterAnimator = ValueAnimator.ofObject(new FloatArrayEvaluator(mCurrentFilter),
            oldFilter, targetFilter);
    mFilterAnimator.setDuration(COLOR_CHANGE_DURATION);
    mFilterAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mPaint.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
            invalidate();
        }
    });
    mFilterAnimator.start();
}
项目:SimpleUILauncher    文件:DragView.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateFilterTo(float[] targetFilter) {
    float[] oldFilter = mCurrentFilter == null ? new ColorMatrix().getArray() : mCurrentFilter;
    mCurrentFilter = Arrays.copyOf(oldFilter, oldFilter.length);

    if (mFilterAnimator != null) {
        mFilterAnimator.cancel();
    }
    mFilterAnimator = ValueAnimator.ofObject(new FloatArrayEvaluator(mCurrentFilter),
            oldFilter, targetFilter);
    mFilterAnimator.setDuration(COLOR_CHANGE_DURATION);
    mFilterAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mPaint.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
            invalidate();
        }
    });
    mFilterAnimator.start();
}
项目:SimplOS    文件:DragView.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateFilterTo(float[] targetFilter) {
    float[] oldFilter = mCurrentFilter == null ? new ColorMatrix().getArray() : mCurrentFilter;
    mCurrentFilter = Arrays.copyOf(oldFilter, oldFilter.length);

    if (mFilterAnimator != null) {
        mFilterAnimator.cancel();
    }
    mFilterAnimator = ValueAnimator.ofObject(new FloatArrayEvaluator(mCurrentFilter),
            oldFilter, targetFilter);
    mFilterAnimator.setDuration(COLOR_CHANGE_DURATION);
    mFilterAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mPaint.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
            invalidate();
        }
    });
    mFilterAnimator.start();
}
项目:Trebuchet    文件:DragView.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateFilterTo(float[] targetFilter) {
    float[] oldFilter = mCurrentFilter == null ? new ColorMatrix().getArray() : mCurrentFilter;
    mCurrentFilter = Arrays.copyOf(oldFilter, oldFilter.length);

    if (mFilterAnimator != null) {
        mFilterAnimator.cancel();
    }
    mFilterAnimator = ValueAnimator.ofObject(new FloatArrayEvaluator(mCurrentFilter),
            oldFilter, targetFilter);
    mFilterAnimator.setDuration(COLOR_CHANGE_DURATION);
    mFilterAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mPaint.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
            invalidate();
        }
    });
    mFilterAnimator.start();
}
项目:FLauncher    文件:DragView.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateFilterTo(float[] targetFilter) {
    float[] oldFilter = mCurrentFilter == null ? new ColorMatrix().getArray() : mCurrentFilter;
    mCurrentFilter = Arrays.copyOf(oldFilter, oldFilter.length);

    if (mFilterAnimator != null) {
        mFilterAnimator.cancel();
    }
    mFilterAnimator = ValueAnimator.ofObject(new FloatArrayEvaluator(mCurrentFilter),
            oldFilter, targetFilter);
    mFilterAnimator.setDuration(COLOR_CHANGE_DURATION);
    mFilterAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mPaint.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
            invalidate();
        }
    });
    mFilterAnimator.start();
}
项目:FLauncher    文件:ButtonDropTarget.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateTextColor(int targetColor) {
    if (mCurrentColorAnim != null) {
        mCurrentColorAnim.cancel();
    }

    mCurrentColorAnim = new AnimatorSet();
    mCurrentColorAnim.setDuration(DragView.COLOR_CHANGE_DURATION);

    if (mSrcFilter == null) {
        mSrcFilter = new ColorMatrix();
        mDstFilter = new ColorMatrix();
        mCurrentFilter = new ColorMatrix();
    }

    DragView.setColorScale(getTextColor(), mSrcFilter);
    DragView.setColorScale(targetColor, mDstFilter);
    ValueAnimator anim1 = ValueAnimator.ofObject(
            new FloatArrayEvaluator(mCurrentFilter.getArray()),
            mSrcFilter.getArray(), mDstFilter.getArray());
    anim1.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mDrawable.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
            invalidate();
        }
    });

    mCurrentColorAnim.play(anim1);
    mCurrentColorAnim.play(ObjectAnimator.ofArgb(this, "textColor", targetColor));
    mCurrentColorAnim.start();
}