当前位置: 首页>>代码示例>>Java>>正文


Java Transformation.getMatrix方法代码示例

本文整理汇总了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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:Rotate3dAnimation.java

示例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);
}
 
开发者ID:riteshakya037,项目名称:Flashcards-Demo,代码行数:23,代码来源:FlipAnimation.java

示例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);
}
 
开发者ID:aesean,项目名称:Rotate3d,代码行数:23,代码来源:Rotate3dAnimation.java

示例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);

}
 
开发者ID:qizhenghao,项目名称:HiBangClient,代码行数:19,代码来源:RotateAnimation.java

示例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);
}
 
开发者ID:ABTSoftware,项目名称:SciChart.Android.Examples,代码行数:17,代码来源:FlipAnimation.java

示例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();
}
 
开发者ID:NICOLITE,项目名称:HutHelper,代码行数:23,代码来源:CourseInfoGallery.java

示例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);
}
 
开发者ID:JustKiddingBaby,项目名称:FragmentRigger,代码行数:23,代码来源:Rotate3dAnimation.java

示例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);
  }
 
开发者ID:JustKiddingBaby,项目名称:FragmentRigger,代码行数:21,代码来源:Rotate3d.java

示例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);
}
 
开发者ID:Evan-Galvin,项目名称:FreeStreams-TVLauncher,代码行数:25,代码来源:Rotate3dAnimation.java

示例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);
}
 
开发者ID:skydoves,项目名称:Medal,代码行数:18,代码来源:MedalAnimation.java

示例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);
    }
}
 
开发者ID:shenhuanet,项目名称:OpenEyesReading-android,代码行数:30,代码来源:RotateAnimation.java

示例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);

}
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:34,代码来源:Rotate3DAnimation.java

示例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);
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:28,代码来源:AnimUtil.java

示例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);
}
 
开发者ID:AbduazizKayumov,项目名称:Flashcard-Maker-Android,代码行数:29,代码来源:FlipAnimation.java

示例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);

}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:23,代码来源:FlipAnimation.java


注:本文中的android.view.animation.Transformation.getMatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。