本文整理匯總了Java中android.view.animation.Transformation.getMatrix方法的典型用法代碼示例。如果您正苦於以下問題:Java Transformation.getMatrix方法的具體用法?Java Transformation.getMatrix怎麽用?Java Transformation.getMatrix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.animation.Transformation
的用法示例。
在下文中一共展示了Transformation.getMatrix方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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 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);
}
示例4: applyTransformation
import android.view.animation.Transformation; //導入方法依賴的package包/類
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
float deg = 0.0F + 360.0F * interpolatedTime;
Matrix matrix = t.getMatrix();
mCamera.save();
if (mMode == Mode.X)
mCamera.rotateX(deg);
if (mMode == Mode.Y)
mCamera.rotateY(deg);
if (mMode == Mode.Z)
mCamera.rotateZ(deg);
mCamera.getMatrix(matrix);
mCamera.restore();
matrix.preTranslate(-mCenterX, -mCenterY);
matrix.postTranslate(mCenterX, mCenterY);
}
示例5: applyTransformation
import android.view.animation.Transformation; //導入方法依賴的package包/類
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
float degrees = fromDegrees + ((toDegrees - fromDegrees) * interpolatedTime);
final Matrix matrix = t.getMatrix();
final Camera camera = mCamera;
camera.save();
camera.rotateY(degrees);
camera.getMatrix(matrix);
camera.restore();
matrix.preTranslate(-centerX, -centerY);
matrix.postTranslate(centerX, centerY);
}
示例6: 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();
}
示例7: 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 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);
}
示例8: 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);
}
示例9: 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 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);
}
示例10: applyTransformation
import android.view.animation.Transformation; //導入方法依賴的package包/類
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
float xDegrees = degreeX * interpolatedTime;
float yDegrees = degreeY * interpolatedTime;
float zDegrees = degreeZ * 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);
}
示例11: applyTransformation
import android.view.animation.Transformation; //導入方法依賴的package包/類
/***
* 這個類需要重寫,在繪製動畫的時候會反複執行. interpolatedTime:該參數從0漸 變為1. 0:表示動畫開始執行. 0.5表示中間值.
* 1:表示動畫結束. Transformation:獲取變化的矩陣.matrix
*/
protected void applyTransformation(float interpolatedTime, Transformation transformation) {
float from = 0.0f, to = 180.0f;
float degree = from + (to - from) * interpolatedTime;//翻轉的角度
if (degree == 180)
return;
if (interpolatedTime > 0.5f) {
// 翻轉過半的情況下,為保證顯示內容不出現鏡麵效果就是對稱形狀,需要將角度逆向回來.
degree = degree - 180;
}
float depth = (0.5f - Math.abs(interpolatedTime - 0.5f)) * DEPTH_Z;//深度
final Matrix matrix = transformation.getMatrix();
mCamera.save();
mCamera.translate(0.0f, 0.0f, depth);
mCamera.rotateY(degree);
mCamera.getMatrix(matrix);
mCamera.restore();
// 確保圖片的翻轉過程一直處於組件的中心點位置
matrix.preTranslate(-centerX, -centerY);
matrix.postTranslate(centerX, centerY);
// interpolatedTime:動畫進度值,範圍為[0.0f,1.0f]
if (listener != null) {
listener.interpolatedTime(interpolatedTime);
}
}
示例12: 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 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));
// 繞y軸旋轉
camera.rotateY(degrees);
camera.getMatrix(matrix);
camera.restore();
// 修正失真,主要修改 MPERSP_0 和 MPERSP_1
float[] mValues = new float[9];
matrix.getValues(mValues); //獲取數值
mValues[6] = mValues[6] / scale; //數值修正
mValues[7] = mValues[7] / scale; //數值修正
matrix.setValues(mValues); //重新賦值
// 調節中心點
matrix.preTranslate(-centerX, -centerY);
matrix.postScale(centerX, centerY);
}
示例13: 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 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));
}
if (mRotateX)
camera.rotateX(degrees);
else
camera.rotateY(degrees);
camera.getMatrix(matrix);
camera.restore();
matrix.preTranslate(-centerX, -centerY);
matrix.postTranslate(centerX, centerY);
}
示例14: applyTransformation
import android.view.animation.Transformation; //導入方法依賴的package包/類
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
// Angle around the y-axis of the rotation at the given time
// calculated both in radians and degrees.
final double radians = Math.PI * interpolatedTime;
float degrees = (float) (180.0 * radians / Math.PI);
// Once we reach the midpoint in the animation, we need to hide the
// source view and show the destination view. We also need to change
// the angle by 180 degrees so that the destination does not come in
// flipped around
if (interpolatedTime >= 0.5f) {
degrees -= 180.f;
fromView.setVisibility(View.GONE);
toView.setVisibility(View.VISIBLE);
}
if (forward)
degrees = -degrees; //determines direction of rotation when flip begins
final Matrix matrix = t.getMatrix();
camera.save();
camera.rotateY(degrees);
camera.getMatrix(matrix);
camera.restore();
matrix.preTranslate(-centerX, -centerY);
matrix.postTranslate(centerX, centerY);
}
示例15: 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 float centerX = mCenterX;
final float centerY = mCenterY;
final Camera camera = mCamera;
final Matrix matrix = t.getMatrix();
camera.save();
camera.rotateY(degrees);
camera.getMatrix(matrix);
camera.restore();
matrix.preTranslate(-centerX, -centerY);
matrix.postTranslate(centerX, centerY);
}