类android.view.animation.Transformation源码实例Demo

下面列出了怎么用android.view.animation.Transformation的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: RxAndroidBootstrap   文件: ExpandAnimation.java
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    super.applyTransformation(interpolatedTime, t);

    if (interpolatedTime < 1.0f) {

        // Calculating the new bottom margin, and setting it
        mViewLayoutParams.bottomMargin = mMarginStart
                + (int) ((mMarginEnd - mMarginStart) * interpolatedTime);

        // Invalidating the layout, making us seeing the changes we made
        mAnimatedView.requestLayout();

        // Making sure we didn't run the ending before (it happens!)
    } else if (!mWasEndedAlready) {
        mViewLayoutParams.bottomMargin = mMarginEnd;
        mAnimatedView.requestLayout();

        if (mIsVisibleAfter) {
            mAnimatedView.setVisibility(View.GONE);
        }
        mWasEndedAlready = true;
    }
}
 
源代码2 项目: Android-tv-widget   文件: Rotate3dAnimation.java
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    final float centerX = mCenterX;
    final float centerY = mCenterY;
    final Camera camera = mCamera;

    final Matrix matrix = t.getMatrix();

    camera.save();
    if (mReverse) {
        camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime);
    } else {
        camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime));
    }
    camera.rotateY(degrees);
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
源代码3 项目: adt-leanback-support   文件: SwipeRefreshLayout.java
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) {
    // Pre API 11, alpha is used in place of scale. Don't also use it to
    // show the trigger point.
    if (mScale && isAlphaUsedForScale()) {
        return null;
    }
    Animation alpha = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            mProgress
                    .setAlpha((int) (startingAlpha+ ((endingAlpha - startingAlpha)
                            * interpolatedTime)));
        }
    };
    alpha.setDuration(ALPHA_ANIMATION_DURATION);
    // Clear out the previous animation listeners.
    mCircleView.setAnimationListener(null);
    mCircleView.clearAnimation();
    mCircleView.startAnimation(alpha);
    return alpha;
}
 
源代码4 项目: android-source-codes   文件: SwipeRefreshLayout.java
private void startScaleDownReturnToStartAnimation(int from,
        Animation.AnimationListener listener) {
    mFrom = from;
    if (isAlphaUsedForScale()) {
        mStartingScale = mProgress.getAlpha();
    } else {
        mStartingScale = ViewCompat.getScaleX(mCircleView);
    }
    mScaleDownToStartAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            float targetScale = (mStartingScale + (-mStartingScale  * interpolatedTime));
            setAnimationProgress(targetScale);
            moveToStart(interpolatedTime);
        }
    };
    mScaleDownToStartAnimation.setDuration(SCALE_DOWN_DURATION);
    if (listener != null) {
        mCircleView.setAnimationListener(listener);
    }
    mCircleView.clearAnimation();
    mCircleView.startAnimation(mScaleDownToStartAnimation);
}
 
源代码5 项目: mooc_hyman   文件: SwipeRefreshLayout.java
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) {
    Animation alpha = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            mBottomProgress
                    .setAlpha((int) (startingAlpha + ((endingAlpha - startingAlpha)
                            * interpolatedTime)));
        }
    };
    alpha.setDuration(ALPHA_ANIMATION_DURATION);
    // Clear out the previous animation listeners.
    mBottomCircleView.setAnimationListener(null);
    mBottomCircleView.clearAnimation();
    mBottomCircleView.startAnimation(alpha);
    return alpha;
}
 
源代码6 项目: recyclerview-expandable   文件: ExpandableItem.java
@UiThread
private void expand(@NonNull final View view) {
    isOpened = true;
    view.measure(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    final int targetHeight = view.getMeasuredHeight();
    view.getLayoutParams().height = 0;
    view.setVisibility(VISIBLE);

    final Animation animation = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            view.getLayoutParams().height = (interpolatedTime == 1)
                ? LayoutParams.WRAP_CONTENT
                : (int) (targetHeight * interpolatedTime);
            view.requestLayout();
        }
    };
    animation.setDuration(duration);
    view.startAnimation(animation);
}
 
源代码7 项目: commcare-android   文件: QuestionWidget.java
private static void collapse(final View v) {
    final int initialHeight = v.getMeasuredHeight();

    Animation a = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1) {
                v.setVisibility(View.GONE);
            } else {
                v.getLayoutParams().height = initialHeight - (int)(initialHeight * interpolatedTime);
                v.requestLayout();
            }
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration((int)(initialHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
}
 
源代码8 项目: Overchan-Android   文件: SwipeRefreshLayout.java
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) {
    // Pre API 11, alpha is used in place of scale. Don't also use it to
    // show the trigger point.
    if (mScale && isAlphaUsedForScale()) {
        return null;
    }
    Animation alpha = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            mProgress
                    .setAlpha((int) (startingAlpha+ ((endingAlpha - startingAlpha)
                            * interpolatedTime)));
        }
    };
    alpha.setDuration(ALPHA_ANIMATION_DURATION);
    // Clear out the previous animation listeners.
    mCircleView.setAnimationListener(null);
    mCircleView.clearAnimation();
    mCircleView.startAnimation(alpha);
    return alpha;
}
 
源代码9 项目: UltimateAndroid   文件: BasicUiUtils.java
public static void collapseViews(final View v) {
    final int initialHeight = v.getMeasuredHeight();

    Animation a = new Animation()
    {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if(interpolatedTime == 1){
                v.setVisibility(View.GONE);
            }else{
                v.getLayoutParams().height = initialHeight - (int)(initialHeight * interpolatedTime);
                v.requestLayout();
            }
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration((int)(initialHeight / v.getContext().getResources().getDisplayMetrics().density)*1);
    v.startAnimation(a);
}
 
源代码10 项目: Overchan-Android   文件: SwipeRefreshLayout.java
private void startScaleUpAnimation(AnimationListener listener) {
    mCircleView.setVisibility(View.VISIBLE);
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        // Pre API 11, alpha is used in place of scale up to show the
        // progress circle appearing.
        // Don't adjust the alpha during appearance otherwise.
        mProgress.setAlpha(MAX_ALPHA);
    }
    mScaleAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            setAnimationProgress(interpolatedTime);
        }
    };
    mScaleAnimation.setDuration(mMediumAnimationDuration);
    if (listener != null) {
        mCircleView.setAnimationListener(listener);
    }
    mCircleView.clearAnimation();
    mCircleView.startAnimation(mScaleAnimation);
}
 
源代码11 项目: AndroidStudyDemo   文件: SwipeRefreshLayout.java
private void startScaleUpAnimation(AnimationListener listener) {
    mCircleView.setVisibility(View.VISIBLE);
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        // Pre API 11, alpha is used in place of scale up to show the
        // progress circle appearing.
        // Don't adjust the alpha during appearance otherwise.
        mProgress.setAlpha(MAX_ALPHA);
    }
    mScaleAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            setAnimationProgress(interpolatedTime);
        }
    };
    mScaleAnimation.setDuration(mMediumAnimationDuration);
    if (listener != null) {
        mCircleView.setAnimationListener(listener);
    }
    mCircleView.clearAnimation();
    mCircleView.startAnimation(mScaleAnimation);
}
 
public static void collapse(final View v) {
    final int initialHeight = v.getMeasuredHeight();

    Animation a = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1) {
                v.setVisibility(View.GONE);
            } else {
                v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime);
                v.requestLayout();
            }
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
}
 
源代码13 项目: android-databinding   文件: SelectModeTest.java
/** collapse animation while start delete item */
private void collapse(final View view, Animation.AnimationListener al) {
    final int originHeight = view.getMeasuredHeight();
    Animation animation = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
                view.getLayoutParams().height = originHeight - (int) (originHeight * interpolatedTime);
                view.requestLayout();
        }
        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };
    if (al != null) {
        animation.setAnimationListener(al);
    }
    animation.setDuration(300);
    view.startAnimation(animation);
}
 
源代码14 项目: BookLoadingView   文件: Rotate3dAnimation.java
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    final float centerX = mCenterX;
    final float centerY = mCenterY;
    final Camera camera = mCamera;

    final Matrix matrix = t.getMatrix();

    camera.save();
    if (mReverse) {
        camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime);
    } else {
        camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime));
    }
    camera.rotateY(degrees);
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
源代码15 项目: 365browser   文件: SwipeRefreshLayout.java
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) {
    // Pre API 11, alpha is used in place of scale. Don't also use it to
    // show the trigger point.
    if (mScale && isAlphaUsedForScale()) {
        return null;
    }
    Animation alpha = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            mProgress
                    .setAlpha((int) (startingAlpha+ ((endingAlpha - startingAlpha)
                            * interpolatedTime)));
        }
    };
    alpha.setDuration(ALPHA_ANIMATION_DURATION);
    // Clear out the previous animation listeners.
    mCircleView.setAnimationListener(null);
    mCircleView.clearAnimation();
    mCircleView.startAnimation(alpha);
    return alpha;
}
 
源代码16 项目: imsdk-android   文件: AndroidTreeView.java
private static void collapse(final View v) {
    final int initialHeight = v.getMeasuredHeight();

    Animation a = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1) {
                v.setVisibility(View.GONE);
            } else {
                v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime);
                v.requestLayout();
            }
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
}
 
源代码17 项目: java-n-IDE-for-Android   文件: AndroidTreeView.java
private static void collapse(final View v) {
    final int initialHeight = v.getMeasuredHeight();

    Animation a = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1) {
                v.setVisibility(View.GONE);
            } else {
                v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime);
                v.requestLayout();
            }
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
}
 
源代码18 项目: CoordinatorLayoutExample   文件: ReboundLayout.java
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    float progress = ((endProgress - startProgress) * interpolatedTime) + startProgress;
    Log.i(TAG, "applyTransformation: interpolatedTime =" + interpolatedTime);
    if (mOrientation == LinearLayout.HORIZONTAL) {
        scrollBy((int) ((MAX_WIDTH - getScrollX()) * progress), 0);
    } else {

        float v = (MAX_WIDTH - getScrollY()) * progress;
        Log.i(TAG, "applyTransformation: getScrollY() =" + getScrollY() + " progress = " + progress + " v =" + v);
        scrollBy(0, (int) v);
    }

    if (progress >= 1) {
        isRunAnim = false;
    }
}
 
源代码19 项目: AndroidProjects   文件: CollapseView.java
/**
 * 折叠
 *
 * @param view 视图
 */
private void collapse(final View view) {
    final int measuredHeight = view.getMeasuredHeight();
    Animation animation = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            Log.e("TAG", "interpolatedTime = " + interpolatedTime);
            if (interpolatedTime == 1) {
                mContentRelativeLayout.setVisibility(GONE);
            } else {
                view.getLayoutParams().height = measuredHeight - (int) (measuredHeight * interpolatedTime);
                view.requestLayout();
            }
        }
    };
    animation.setDuration(duration);
    view.startAnimation(animation);
}
 
源代码20 项目: Lunary-Ethereum-Wallet   文件: CollapseAnimator.java
public static void expand(final View v) {
    v.measure(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    final int targetHeight = v.getMeasuredHeight();

    // Older versions of android (pre API 21) cancel animations for views with a height of 0.
    v.getLayoutParams().height = 1;
    v.setVisibility(View.VISIBLE);
    Animation a = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height = interpolatedTime == 1
                    ? ViewGroup.LayoutParams.WRAP_CONTENT
                    : (int) (targetHeight * interpolatedTime);
            v.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration((int) (targetHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
}
 
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float degrees = mFromDegrees + ((mToDegrees - mFromDegrees) * interpolatedTime);
    if (mPivotX == 0.0f && mPivotY == 0.0f) {
        t.getMatrix().setRotate(degrees);
    } else {
        t.getMatrix().setRotate(degrees, mPivotX, mPivotY);
    }

    float dx = mFromXDelta;
    float dy = mFromYDelta;
    if (mFromXDelta != mToXDelta) {
        dx = mFromXDelta + ((mToXDelta - mFromXDelta) * interpolatedTime);
    }
    if (mFromYDelta != mToYDelta) {
        dy = mFromYDelta + ((mToYDelta - mFromYDelta) * interpolatedTime);
    }

    t.getMatrix().postTranslate(dx, dy);
}
 
源代码22 项目: umeng_community_android   文件: UserInfoAnimator.java
@Override
protected void initAnimation(final boolean show) {
    mAnimation = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime < 0) { // 预处理加速器可能出现负数
                return;
            }
            MarginLayoutParams params = (MarginLayoutParams) mView.getLayoutParams();
            policyMargin(interpolatedTime, params, show);
            mView.setLayoutParams(params);
        }
    };
    mAnimation.setDuration(500);
    mAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
}
 
源代码23 项目: timecat   文件: CropImageAnimation.java
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {

    mAnimRect.left = mStartCropWindowRect.left + (mEndCropWindowRect.left - mStartCropWindowRect.left) * interpolatedTime;
    mAnimRect.top = mStartCropWindowRect.top + (mEndCropWindowRect.top - mStartCropWindowRect.top) * interpolatedTime;
    mAnimRect.right = mStartCropWindowRect.right + (mEndCropWindowRect.right - mStartCropWindowRect.right) * interpolatedTime;
    mAnimRect.bottom = mStartCropWindowRect.bottom + (mEndCropWindowRect.bottom - mStartCropWindowRect.bottom) * interpolatedTime;
    mCropOverlayView.setCropWindowRect(mAnimRect);

    for (int i = 0; i < mAnimPoints.length; i++) {
        mAnimPoints[i] = mStartBoundPoints[i] + (mEndBoundPoints[i] - mStartBoundPoints[i]) * interpolatedTime;
    }
    mCropOverlayView.setBounds(mAnimPoints, mImageView.getWidth(), mImageView.getHeight());

    for (int i = 0; i < mAnimMatrix.length; i++) {
        mAnimMatrix[i] = mStartImageMatrix[i] + (mEndImageMatrix[i] - mStartImageMatrix[i]) * interpolatedTime;
    }
    Matrix m = mImageView.getImageMatrix();
    m.setValues(mAnimMatrix);
    mImageView.setImageMatrix(m);

    mImageView.invalidate();
    mCropOverlayView.invalidate();
}
 
源代码24 项目: AndroidPlayground   文件: Rotate3dAnimation.java
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    float xDegrees = fromXDegrees + ((toXDegrees - fromXDegrees) * interpolatedTime);
    float yDegrees = fromYDegrees + ((toYDegrees - fromYDegrees) * interpolatedTime);
    float zDegrees = fromZDegrees + ((toZDegrees - fromZDegrees) * interpolatedTime);

    final Matrix matrix = t.getMatrix();

    camera.save();
    camera.rotateX(xDegrees);
    camera.rotateY(yDegrees);
    camera.rotateZ(zDegrees);
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-this.width, -this.height);
    matrix.postTranslate(this.width, this.height);
}
 
源代码25 项目: codeexamples-android   文件: Rotate3dAnimation.java
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    final float centerX = mCenterX;
    final float centerY = mCenterY;
    final Camera camera = mCamera;

    final Matrix matrix = t.getMatrix();

    camera.save();
    if (mReverse) {
        camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime);
    } else {
        camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime));
    }
    camera.rotateY(degrees);
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
源代码26 项目: BookReader   文件: SwipeRefreshLayout.java
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) {
    // Pre API 11, alpha is used in place of scale. Don't also use it to
    // show the trigger point.
    if (mScale && isAlphaUsedForScale()) {
        return null;
    }
    Animation alpha = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            mProgress
                    .setAlpha((int) (startingAlpha+ ((endingAlpha - startingAlpha)
                            * interpolatedTime)));
        }
    };
    alpha.setDuration(ALPHA_ANIMATION_DURATION);
    // Clear out the previous animation listeners.
    mCircleView.setAnimationListener(null);
    mCircleView.clearAnimation();
    mCircleView.startAnimation(alpha);
    return alpha;
}
 
源代码27 项目: RxAndroidBootstrap   文件: DownExpandAnimation.java
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    super.applyTransformation(interpolatedTime, t);

    if (interpolatedTime < 1.0f) {

        // Calculating the new bottom margin, and setting it
        mViewLayoutParams.bottomMargin = mMarginStart
                + (int) ((mMarginEnd - mMarginStart) * interpolatedTime);

        // Invalidating the layout, making us seeing the changes we made
        mAnimatedView.requestLayout();

        // Making sure we didn't run the ending before (it happens!)
    } else if (!mWasEndedAlready) {
        mViewLayoutParams.bottomMargin = mMarginEnd;
        mAnimatedView.requestLayout();

        if (mIsVisibleAfter) {
            mAnimatedView.setVisibility(View.GONE);
        }
        mWasEndedAlready = true;
    }
}
 
private static Animation expandAction(final View v) {
    v.measure(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    final int targtetHeight = v.getMeasuredHeight();

    v.getLayoutParams().height = 0;
    v.setVisibility(View.VISIBLE);
    Animation a = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height = interpolatedTime == 1
                    ? LayoutParams.WRAP_CONTENT
                    : (int) (targtetHeight * interpolatedTime);
            v.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    a.setDuration((int) (targtetHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
    return a;
}
 
源代码29 项目: NewXmPluginSDK   文件: AutoTextView.java
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    final float centerX = mCenterX;
    final float centerY = mCenterY;
    final Camera camera = mCamera;
    final int derection = mTurnUp ? 1 : -1;

    final Matrix matrix = t.getMatrix();

    camera.save();
    if (mTurnIn) {
        camera.translate(0.0f, derection * mCenterY * (interpolatedTime - 1.0f), 0.0f);
    } else {
        camera.translate(0.0f, derection * mCenterY * (interpolatedTime), 0.0f);
    }
    camera.rotateX(degrees);
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
源代码30 项目: CircleProgressBar   文件: CircleBar.java
/**
 * 每次系统调用这个方法时, 改变mSweepAnglePer,mPercent,stepnumbernow的值,
 * 然后调用postInvalidate()不停的绘制view。
 */
@Override
protected void applyTransformation(float interpolatedTime,
                                   Transformation t) {
    super.applyTransformation(interpolatedTime, t);
    if (interpolatedTime < 1.0f) {
        mPercent = Float.parseFloat(fnum.format(interpolatedTime
                * stepnumber * 100f / stepnumbermax));// 将浮点值四舍五入保留一位小数
        mSweepAnglePer = interpolatedTime * stepnumber * 360
                / stepnumbermax;
        stepnumbernow = (int) (interpolatedTime * stepnumber);
    } else {
        mPercent = Float.parseFloat(fnum.format(stepnumber * 100f
                / stepnumbermax));// 将浮点值四舍五入保留一位小数
        mSweepAnglePer = stepnumber * 360 / stepnumbermax;
        stepnumbernow = stepnumber;
    }
    postInvalidate();
}