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


Java Camera.translate方法代码示例

本文整理汇总了Java中android.graphics.Camera.translate方法的典型用法代码示例。如果您正苦于以下问题:Java Camera.translate方法的具体用法?Java Camera.translate怎么用?Java Camera.translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Camera的用法示例。


在下文中一共展示了Camera.translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyTransformation

import android.graphics.Camera; //导入方法依赖的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

示例2: applyTransformation

import android.graphics.Camera; //导入方法依赖的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

示例3: applyTransformation

import android.graphics.Camera; //导入方法依赖的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

示例4: applyTransformation

import android.graphics.Camera; //导入方法依赖的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 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);
}
 
开发者ID:MiEcosystem,项目名称:NewXmPluginSDK,代码行数:26,代码来源:AutoTextView.java

示例5: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    float tmpFromDegrees = fromDegrees;
    float degrees = tmpFromDegrees + ((toDegrees - tmpFromDegrees) * interpolatedTime);
    float tmpCenterX = centerX;
    float tmpCenterY = centerY;
    Camera tmpCamera = camera;
    Matrix matrix = t.getMatrix();
    LogUtils.d("interpolatedTime: " + interpolatedTime);
    tmpCamera.save();
    if (reverse) {
        tmpCamera.translate(0f, 0f, depthZ * interpolatedTime);
    } else {
        tmpCamera.translate(0f, 0f, depthZ * (1.0f - interpolatedTime));
    }
    tmpCamera.rotateY(degrees);
    tmpCamera.getMatrix(matrix);
    camera.restore();
    matrix.preTranslate(-tmpCenterX, -tmpCenterY);
    matrix.postTranslate(tmpCenterX, tmpCenterY);
    super.applyTransformation(interpolatedTime, t);
}
 
开发者ID:BruceHurrican,项目名称:asstudydemo,代码行数:23,代码来源:Rotate3dAnim.java

示例6: applyTransformation

import android.graphics.Camera; //导入方法依赖的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.setLocation(0, 0, 60);
    camera.rotateY(degrees);
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:talobin,项目名称:cardentry,代码行数:25,代码来源:RotateAnimation.java

示例7: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    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.rotateX(degrees);
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-mCenterX * mWidth, -mCenterY * mHeight);
    matrix.postTranslate(mCenterX * mWidth, mCenterY * mHeight);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:22,代码来源:Rotate3DAnimation.java

示例8: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = this.fromDegrees;
    float degrees = fromDegrees + ((toDegrees - fromDegrees) * interpolatedTime);
    final float centerX = xCenter;
    final float centerY = yCenter;
    final Camera camera = this.camera;
    final Matrix matrix = t.getMatrix(); //保存一次camera初始状态,用于restore()
    camera.save();
    if (reverse) {
        camera.translate(0.0f, 0.0f, zDepth * interpolatedTime);
    } else {
        camera.translate(0.0f, 0.0f, zDepth * (1.0f - interpolatedTime));
    }
    //围绕Y轴旋转degrees度
    camera.rotateY(degrees);
    //行camera中取出矩阵,赋值给matrix
    camera.getMatrix(matrix);
    //camera恢复到初始状态,继续用于下次的计算
    camera.restore();
    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:2BAB,项目名称:WeatherX,代码行数:24,代码来源:RotationAnim.java

示例9: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = m_fromDegree;
    float degrees = fromDegrees + ((m_toDegree - fromDegrees) * interpolatedTime);
    final float centerX = m_centerX;
    final float centerY = m_centerY;
    final Camera camera = m_camera;
    final Matrix matrix = t.getMatrix();
    camera.save();
    if (m_reverse) {
        camera.translate(0.0f, 0.0f, m_depthZ * interpolatedTime);
    } else {
        camera.translate(0.0f, 0.0f, m_depthZ * (1.0f - interpolatedTime));
    }
    camera.rotateY(degrees);
    camera.getMatrix(matrix);
    camera.restore();
    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:AppCanOpenSource,项目名称:appcan-android,代码行数:21,代码来源:EBrowserAnimation.java

示例10: applyTransformation

import android.graphics.Camera; //导入方法依赖的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

示例11: applyTransformation

import android.graphics.Camera; //导入方法依赖的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

示例12: applyTransformation

import android.graphics.Camera; //导入方法依赖的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 (mRotateType == TYPEX) {
        camera.rotateX(degrees);
    } else if (mRotateType == TYPEY) {
        camera.rotateY(degrees);
    } else if (mRotateType == TYPEZ) {
        camera.rotateZ(degrees);
    }
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:AJellyBean,项目名称:CloudPan,代码行数:32,代码来源:Rotate3dAnimation.java

示例13: applyTransformation

import android.graphics.Camera; //导入方法依赖的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));
    }
    switch (rotationAxis) {
        case X:
            camera.rotateX(degrees);
            break;
        case Y:
            camera.rotateY(degrees);
            break;
        case Z:
            camera.rotateZ(degrees);
            break;
    }

    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:MobileTribe,项目名称:pandroid,代码行数:39,代码来源:Rotate3dAnimation.java

示例14: applyTransformation

import android.graphics.Camera; //导入方法依赖的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.translate,这个方法接受3个参数,分别是x,y,z三个轴的偏移量,我们这里只将z轴进行了偏移,
    if (mReverse) {
        // z的偏移会越来越大。这就会形成这样一个效果,view从近到远
        camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime);
    } else {
        // z的偏移会越来越小。这就会形成这样一个效果,我们的View从一个很远的地方向我们移过来,越来越近,最终移到了我们的窗口上面~
        camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime));
    }

    // 是给我们的View加上旋转效果,在移动的过程中,视图还会移Y轴为中心进行旋转。
    camera.rotateY(degrees);
    // 是给我们的View加上旋转效果,在移动的过程中,视图还会移X轴为中心进行旋转。
    // camera.rotateX(degrees);

    // 这个是将我们刚才定义的一系列变换应用到变换矩阵上面,调用完这句之后,我们就可以将camera的位置恢复了,以便下一次再使用。
    camera.getMatrix(matrix);
    // camera位置恢复
    camera.restore();

    // 以View的中心点为旋转中心,如果不加这两句,就是以(0,0)点为旋转中心
    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:BigAppOS,项目名称:BigApp_WordPress_Android,代码行数:34,代码来源:Rotate3dAnimation.java

示例15: onDraw

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
	protected void onDraw(Canvas canvas) {
//		super.onDraw(canvas);
		Matrix matrix=new Matrix();
		matrix.postTranslate(100, 200);
		matrix.mapPoints(dst, src);
		System.out.println("mapPoints_____>>>src first Point X:" + src[0] + "\t  Y:" + src[1]);//src是记录的原点  [0,0]点
		System.out.println("mapPoints_____>>>dst first Point X:"+ dst[0]+"\t  Y:"+dst[1]);//dst是 src通过矩阵变换的点 [0,0]点对应到 [100,200]
		canvas.drawBitmap(bt, matrix, paint);

		//通过下边的三个方法  可以通过  dst矩阵变化后的点  通过矩阵 逆向方法 转换到 invertDst  即是src原点位置   所以dst中[100,200]的点 即是inverDst[0,0]这个点即 src[0,0]点
		Matrix invertMatrix = new Matrix();
		matrix.invert(invertMatrix);
		invertMatrix.mapPoints(invertDst, dst);
		System.out.println("invertMatrix_____>>>mapPoints  invertDst first Point X:" + invertDst[0] + "\t  Y:" + invertDst[1]);

		//测试postConcat
		Matrix matrixCon =new Matrix();
		matrixCon.postTranslate(100, 200);
		matrix.postConcat(matrixCon);
		matrix.mapPoints(dst, src);
		System.out.println("matrixCon:  mapPoints_____>>>src first Point X:" + src[0] + "\t  Y:" + src[1]);//src是记录的原点  [0,0]点
		System.out.println("matrixCon:  mapPoints_____>>>dst first Point X:"+ dst[0]+"\t  Y:"+dst[1]);


		//测试Camera getMatrix
		Camera camera=new Camera();
		camera.save();
		camera.translate(100,200,0);
		camera.getMatrix(matrix);
		camera.restore();
		matrix.mapPoints(dst, src);
		System.out.println("Camera:  mapPoints_____>>>src first Point X:" + src[0] + "\t  Y:" + src[1]);//src是记录的原点  [0,0]点
		System.out.println("Camera:  mapPoints_____>>>dst first Point X:"+ dst[0]+"\t  Y:"+dst[1]);

	}
 
开发者ID:luhaoaimama1,项目名称:zone-sdk,代码行数:37,代码来源:MatrixView.java


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