當前位置: 首頁>>代碼示例>>Java>>正文


Java Transformation類代碼示例

本文整理匯總了Java中android.view.animation.Transformation的典型用法代碼示例。如果您正苦於以下問題:Java Transformation類的具體用法?Java Transformation怎麽用?Java Transformation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Transformation類屬於android.view.animation包,在下文中一共展示了Transformation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateLineLTRAnimation

import android.view.animation.Transformation; //導入依賴的package包/類
private Animation generateLineLTRAnimation(final RectF rectF, long offset) {

		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);
				if (getCurrentState() == HBButtonState.NORMAL) {
					rectF.set(rectF.left, rectF.top, currentRight - (currentRight - currentLeft) / 2 * interpolatedTime, rectF.bottom);
				} else {
					rectF.set(rectF.left, rectF.top, currentRight + (currentRight - currentLeft) * interpolatedTime, rectF.bottom);
				}
				invalidate();
			}
		};
		animation.setDuration(getAnimationDuration());
		animation.setStartOffset(offset);
		return animation;
	}
 
開發者ID:LongDinhF,項目名稱:Hamburger-Button,代碼行數:22,代碼來源:HBButton.java

示例2: generateLineRTLAnimation

import android.view.animation.Transformation; //導入依賴的package包/類
private Animation generateLineRTLAnimation(final RectF rectF, long offset) {

		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);
				if (getCurrentState() == HBButtonState.NORMAL) {
					rectF.set(currentLeft + (currentRight - currentLeft) / 2 * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
				} else {
					rectF.set(currentLeft - (currentRight - currentLeft) * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
				}
				invalidate();
			}
		};
		animation.setDuration(getAnimationDuration());
		animation.setStartOffset(offset);
		return animation;
	}
 
開發者ID:LongDinhF,項目名稱:Hamburger-Button,代碼行數:22,代碼來源:HBButton.java

示例3: applyTransformation

import android.view.animation.Transformation; //導入依賴的package包/類
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
    int targetTop = 0;
    int endTarget = 0;
    if (!mUsingCustomStart) {
        switch (mDirection) {
            case BOTTOM:
                endTarget = getMeasuredHeight() - (int) (mSpinnerFinalOffset);
                break;
            case TOP:
            default:
                endTarget = (int) (mSpinnerFinalOffset - Math.abs(mOriginalOffsetTop));
                break;
        }
    } else {
        endTarget = (int) mSpinnerFinalOffset;
    }
    targetTop = (mFrom + (int) ((endTarget - mFrom) * interpolatedTime));
    int offset = targetTop - mCircleView.getTop();
    setTargetOffsetTopAndBottom(offset, false /* requires update */);
}
 
開發者ID:HanyeeWang,項目名稱:GeekZone,代碼行數:22,代碼來源:SwipeRefreshLayout.java

示例4: transformImageBitmap

import android.view.animation.Transformation; //導入依賴的package包/類
private void transformImageBitmap(View child, Transformation t,
                                  int rotationAngle) {
    mCamera.save();
    final Matrix imageMatrix = t.getMatrix();
    final int imageHeight = child.getLayoutParams().height;
    final int imageWidth = child.getLayoutParams().width;
    final int rotation = Math.abs(rotationAngle);

    mCamera.translate(0.0f, 0.0f, 100.0f);

    // As the angle of the view gets less, zoom in
    if (rotation < mMaxRotationAngle) {
        float zoomAmount = (float) (mMaxZoom + (rotation * 1.5));
        mCamera.translate(0.0f, 0.0f, zoomAmount);
    }

    mCamera.rotateY(rotationAngle);
    mCamera.getMatrix(imageMatrix);
    imageMatrix.preTranslate(-(imageWidth / 2), -(imageHeight / 2));
    imageMatrix.postTranslate((imageWidth / 2), (imageHeight / 2));
    mCamera.restore();
}
 
開發者ID:NICOLITE,項目名稱:HutHelper,代碼行數:23,代碼來源:CourseInfoGallery.java

示例5: applyTransformation

import android.view.animation.Transformation; //導入依賴的package包/類
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    final Matrix matrix = t.getMatrix();

    mCamera.save();
    switch (mRollType) {
        case ROLL_BY_X:
            mCamera.rotateX(degrees);
            break;
        case ROLL_BY_Y:
            mCamera.rotateY(degrees);
            break;
        case ROLL_BY_Z:
            mCamera.rotateZ(degrees);
            break;
    }
    mCamera.getMatrix(matrix);
    mCamera.restore();

    matrix.preTranslate(-mPivotX, -mPivotY);
    matrix.postTranslate(mPivotX, mPivotY);
}
 
開發者ID:weimin96,項目名稱:shareNote,代碼行數:26,代碼來源:Rotate3dAnimation.java

示例6: startScaleDownReturnToStartAnimation

import android.view.animation.Transformation; //導入依賴的package包/類
@SuppressLint("NewApi")
private void startScaleDownReturnToStartAnimation(Animation.AnimationListener listener) {
    mStartingScale = mRefreshView.getScaleX();
    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) {
        mScaleDownToStartAnimation.setAnimationListener(listener);
    }
    mRefreshView.clearAnimation();
    mRefreshView.startAnimation(mScaleDownToStartAnimation);
}
 
開發者ID:yangjiantao,項目名稱:AndroidUiKit,代碼行數:19,代碼來源:ISwipeRefreshLayout.java

示例7: startScaleDownReturnToStartAnimation

import android.view.animation.Transformation; //導入依賴的package包/類
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);
}
 
開發者ID:unixzii,項目名稱:android-source-codes,代碼行數:24,代碼來源:SwipeRefreshLayout.java

示例8: startAlphaAnimation

import android.view.animation.Transformation; //導入依賴的package包/類
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;
}
 
開發者ID:zwmlibs,項目名稱:BookReader-master,代碼行數:22,代碼來源:SwipeRefreshLayout.java

示例9: startAlphaAnimation

import android.view.animation.Transformation; //導入依賴的package包/類
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;
}
 
開發者ID:aliumujib,項目名稱:SwipeToRefresh,代碼行數:22,代碼來源:SwipeToRefreshLayout.java

示例10: applyTransformation

import android.view.animation.Transformation; //導入依賴的package包/類
@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);
}
 
開發者ID:cheenid,項目名稱:FLFloatingButton,代碼行數:21,代碼來源:RotateAndTranslateAnimation.java

示例11: applyTransformation

import android.view.animation.Transformation; //導入依賴的package包/類
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final double radians = Math.PI * interpolatedTime;
    float degrees = (float) (180.0 * radians / Math.PI);

    if (interpolatedTime >= 0.5f) { // Alternate the visibility of views at the exact half of animation duration.
        degrees -= 180.f;
        fromView.setVisibility(View.GONE);
        toView.setVisibility(View.VISIBLE);
    }

    if (forward)
        degrees = -degrees;

    final Matrix matrix = t.getMatrix();
    camera.save();
    camera.rotateY(degrees);
    camera.getMatrix(matrix);
    camera.restore();
    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
開發者ID:riteshakya037,項目名稱:Flashcards-Demo,代碼行數:23,代碼來源:FlipAnimation.java

示例12: startScaleUpAnimation

import android.view.animation.Transformation; //導入依賴的package包/類
private void startScaleUpAnimation(AnimationListener listener) {
    mHeadViewContainer.setVisibility(View.VISIBLE);
    mScaleAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime,
                                        Transformation t) {
            setAnimationProgress(interpolatedTime);
        }
    };
    mScaleAnimation.setDuration(mMediumAnimationDuration);
    if (listener != null) {
        mHeadViewContainer.setAnimationListener(listener);
    }
    mHeadViewContainer.clearAnimation();
    mHeadViewContainer.startAnimation(mScaleAnimation);
}
 
開發者ID:GaoGersy,項目名稱:MultiSelecter,代碼行數:17,代碼來源:SuperSwipeRefreshLayout.java

示例13: expand

import android.view.animation.Transformation; //導入依賴的package包/類
public void expand() {
    if (!isExpand) {
        isExpand = true;
        mText.setTextColor(Color.TRANSPARENT);
        mExpandText.setTextColor(mTextColor);
        Animation animation = new Animation() {
            @Override
            protected void applyTransformation(float interpolatedTime, Transformation t) {
                ViewGroup.LayoutParams params = ExpandTextView.this.getLayoutParams();
                params.height = mStart + (int) ((mEnd - mStart) * interpolatedTime);
                setLayoutParams(params);
            }
        };
        animation.setDuration(500);
        startAnimation(animation);
    }

}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:19,代碼來源:ExpandTextView.java

示例14: applyTransformation

import android.view.animation.Transformation; //導入依賴的package包/類
@Override
  protected void applyTransformation(float interpolatedTime, Transformation t) {
    Camera camera = new Camera();
    camera.save();

    // 設置camera動作為繞Y軸旋轉
    // 總共旋轉180度,因此計算在每個補間時間點interpolatedTime的角度即為兩著相乘
//    camera.rotateX(deg * interpolatedTime);
    camera.rotateY(180 * interpolatedTime);
//    camera.rotateZ(180 * interpolatedTime);
//
    // 根據camera動作產生一個matrix,賦給Transformation的matrix,以用來設置動畫效果
    Matrix matrix = t.getMatrix();
    camera.getMatrix(matrix);

    camera.restore();
    //經過以下平移,才能以view的中心點進行翻轉
    matrix.preTranslate(-view.getWidth() / 2, -view.getHeight() / 2);
    matrix.postTranslate(view.getWidth() / 2, view.getHeight() / 2);
  }
 
開發者ID:JustKiddingBaby,項目名稱:FragmentRigger,代碼行數:21,代碼來源:Rotate3d.java

示例15: applyTransformation

import android.view.animation.Transformation; //導入依賴的package包/類
@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();
}
 
開發者ID:chuch0805,項目名稱:Android-Demo_ImageCroper,代碼行數:25,代碼來源:CropImageAnimation.java


注:本文中的android.view.animation.Transformation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。