java类android.view.animation.Transformation的实例源码

ExpandableLayout.java 文件源码 项目:boohee_v5.6 阅读 28 收藏 0 点赞 0 评论 0
private void expand(final View v) {
    v.measure(-1, -2);
    final int targetHeight = v.getMeasuredHeight();
    v.getLayoutParams().height = 0;
    v.setVisibility(0);
    this.animation = new Animation() {
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1.0f) {
                ExpandableLayout.this.isOpened = Boolean.valueOf(true);
            }
            v.getLayoutParams().height = interpolatedTime == 1.0f ? -2 : (int) (((float)
                    targetHeight) * interpolatedTime);
            v.requestLayout();
        }

        public boolean willChangeBounds() {
            return true;
        }
    };
    this.animation.setDuration((long) this.duration.intValue());
    v.startAnimation(this.animation);
}
Rotate3dAnimation.java 文件源码 项目:Rotate3d 阅读 23 收藏 0 点赞 0 评论 0
@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);
}
SwipeToRefreshLayout.java 文件源码 项目:AndroidOpen 阅读 27 收藏 0 点赞 0 评论 0
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    int targetTop;
    int endTarget;
    switch (mType) {
        case BOTTOM:
            endTarget = getMeasuredHeight() - (int) (mSpinnerFinalOffset);
            break;
        case TOP:
        default:
            endTarget = (int) (mSpinnerFinalOffset - Math.abs(mOriginalOffsetTop));
            break;
    }
    targetTop = (mFrom + (int) ((endTarget - mFrom) * interpolatedTime));
    int offset = targetTop - mLoadingView.getTop();
    setTargetOffsetTopAndBottom(offset, false);
}
MorphAnimation.java 文件源码 项目:Android-MorphAnimation 阅读 21 收藏 0 点赞 0 评论 0
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    try {
        if (mTargetView != null && mAnimationStep == ANIMATION_STEP_PLAY) {
            LayoutParams l = mTargetView.getLayoutParams();

            if (mAnimationMode == ANIMATION_MODE_WIDTH || mAnimationMode == ANIMATION_MODE)
                l.width = (int) (startX + (toX - startX) * interpolatedTime);

            if (mAnimationMode == ANIMATION_MODE_HEIGHT || mAnimationMode == ANIMATION_MODE)
                l.height = (int) (startY + (toY - startY) * interpolatedTime);

            mTargetView.requestLayout();
        }
    } catch (Exception e) {
        Log.e(TAG, "Exception applyTransformation", e);
    }
}
SwipeRefreshLayout.java 文件源码 项目:letv 阅读 30 收藏 0 点赞 0 评论 0
private void startScaleDownAnimation(AnimationListener listener) {
    this.mScaleDownAnimation = new Animation() {
        public void applyTransformation(float interpolatedTime, Transformation t) {
            SwipeRefreshLayout.this.setAnimationProgress(1.0f - interpolatedTime);
        }
    };
    this.mScaleDownAnimation.setDuration(150);
    this.mCircleView.setAnimationListener(listener);
    this.mCircleView.clearAnimation();
    this.mCircleView.startAnimation(this.mScaleDownAnimation);
}
HBButton.java 文件源码 项目:Hamburger-Button 阅读 34 收藏 0 点赞 0 评论 0
private Animation generateLineBackRTLStep1(final RectF rectF) {
    final float currentLeft = rectF.left;
    final float currentRight = rectF.right;

    Animation animation = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            super.applyTransformation(interpolatedTime, t);
            rectF.set(currentLeft - (currentRight - currentLeft) * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
            invalidate();
        }
    };
    animation.setDuration(getAnimationDuration() / 4);
    return animation;
}
HBButton.java 文件源码 项目:Hamburger-Button 阅读 25 收藏 0 点赞 0 评论 0
private Animation generateLineBackRTLStep2(final RectF rectF) {
    final float currentLeft = rectF.left;
    final float currentRight = rectF.right;

    Animation animation = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            super.applyTransformation(interpolatedTime, t);
            rectF.set(rectF.left, rectF.top, currentRight - (currentRight - currentLeft) * interpolatedTime, rectF.bottom);
            invalidate();
        }
    };
    animation.setDuration(getAnimationDuration() / 4);
    return animation;
}
SuperSwipeRefreshLayout.java 文件源码 项目:ZhaZhaShop 阅读 24 收藏 0 点赞 0 评论 0
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
    int targetTop = 0;
    int endTarget = 0;
    if (!mUsingCustomStart) {
        endTarget = (int) (mSpinnerFinalOffset - Math
                .abs(mOriginalOffsetTop));
    } else {
        endTarget = (int) mSpinnerFinalOffset;
    }
    targetTop = (mFrom + (int) ((endTarget - mFrom) * interpolatedTime));
    int offset = targetTop - mHeadViewContainer.getTop();
    setTargetOffsetTopAndBottom(offset, false /* requires update */);
}
TaurusHeader.java 文件源码 项目:GitHub 阅读 19 收藏 0 点赞 0 评论 0
private void setupAnimations() {
    mAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, @NonNull Transformation t) {
            setLoadingAnimationTime(interpolatedTime);
        }
    };
    mAnimation.setRepeatCount(Animation.INFINITE);
    mAnimation.setRepeatMode(Animation.REVERSE);
    mAnimation.setInterpolator(ACCELERATE_DECELERATE_INTERPOLATOR);
    mAnimation.setDuration(ANIMATION_DURATION);
}
DefaultScanCursorView.java 文件源码 项目:QRCodeScanner 阅读 23 收藏 0 点赞 0 评论 0
@Override
public boolean getTransformation(long currentTime, Transformation outTransformation) {
    if (mPaused && mElapsedAtPause == 0) {
        mElapsedAtPause = currentTime - getStartTime();
    }
    if (mPaused)
        setStartTime(currentTime - mElapsedAtPause);
    return super.getTransformation(currentTime, outTransformation);
}


问题


面经


文章

微信
公众号

扫码关注公众号