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


Java Camera.rotateX方法代碼示例

本文整理匯總了Java中android.graphics.Camera.rotateX方法的典型用法代碼示例。如果您正苦於以下問題:Java Camera.rotateX方法的具體用法?Java Camera.rotateX怎麽用?Java Camera.rotateX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.Camera的用法示例。


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

示例1: drawIconOne

import android.graphics.Camera; //導入方法依賴的package包/類
/**
 * 根據角度繪製圖標的類
 * @param canvas 畫布
 * @param fraction 完成時間百分比
 * @param icon 圖標
 * @param width view寬度
 * @param height view高度
 */
private void drawIconOne(Canvas canvas, float fraction, Bitmap icon, int width, int height) {
    Camera camera = new Camera();
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    canvas.save();
    int centerX = width / 2;
    int centerY = height / 2 - 200;
    int x = centerX - icon.getWidth()/2;
    int y = centerY - icon.getHeight()/2;
    Matrix matrix = new Matrix();
    matrix.postScale(1.7f, 1.7f, centerX, centerY);
    canvas.concat(matrix);
    canvas.clipRect(x, y, x + icon.getWidth() * fraction * 0.5f, y + icon.getHeight() * fraction * 0.5f);
    canvas.translate(centerX, centerY);
    camera.save();
    camera.rotateX(180);
    camera.rotateY(-180);
    camera.applyToCanvas(canvas);
    camera.restore();
    canvas.translate(-centerX, -centerY);
    canvas.drawBitmap(icon, x, y, paint);
    canvas.restore();
}
 
開發者ID:JoshuaRogue,項目名稱:FancyView,代碼行數:31,代碼來源:RotationDrawStrategy.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 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

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

示例4: applyTransformation

import android.graphics.Camera; //導入方法依賴的package包/類
protected final void applyTransformation(float paramFloat, Transformation transformation) {
    float f1 = 0.0F - 360.0F * paramFloat;
    float f2 = mWidth;
    float f3 = mHeight;
    final Camera camera = mCamera;
    Matrix matrix = transformation.getMatrix();
    camera.save();
    if ((0x1 & mRotationFlags) == 1)
        camera.rotateX(f1);
    if ((0x2 & mRotationFlags) == 2)
        camera.rotateY(f1);
    if ((0x4 & mRotationFlags) == 4)
        camera.rotateZ(f1);
    camera.getMatrix(matrix);
    camera.restore();
    matrix.preTranslate(-f2, -f3);
    matrix.postTranslate(f2, f3);
}
 
開發者ID:AppCanOpenSource,項目名稱:appcan-android,代碼行數:19,代碼來源:YAxisAnimation.java

示例5: transformMatrix

import android.graphics.Camera; //導入方法依賴的package包/類
private void transformMatrix(Matrix m, View view) {
    final float w = view.getWidth();
    final float h = view.getHeight();
    final boolean hasPivot = mHasPivot;
    final float pX = hasPivot ? mPivotX : w / 2f;
    final float pY = hasPivot ? mPivotY : h / 2f;

    final float rX = mRotationX;
    final float rY = mRotationY;
    final float rZ = mRotationZ;
    if ((rX != 0) || (rY != 0) || (rZ != 0)) {
        final Camera camera = mCamera;
        camera.save();
        camera.rotateX(rX);
        camera.rotateY(rY);
        camera.rotateZ(-rZ);
        camera.getMatrix(m);
        camera.restore();
        m.preTranslate(-pX, -pY);
        m.postTranslate(pX, pY);
    }

    final float sX = mScaleX;
    final float sY = mScaleY;
    if ((sX != 1.0f) || (sY != 1.0f)) {
        m.postScale(sX, sY);
        final float sPX = -(pX / w) * ((sX * w) - w);
        final float sPY = -(pY / h) * ((sY * h) - h);
        m.postTranslate(sPX, sPY);
    }

    m.postTranslate(mTranslationX, mTranslationY);
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:34,代碼來源:AnimatorProxy.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));
    }
    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

示例7: transformMatrix

import android.graphics.Camera; //導入方法依賴的package包/類
private void transformMatrix(Matrix m, View view) {
    float w = (float) view.getWidth();
    float h = (float) view.getHeight();
    boolean hasPivot = this.mHasPivot;
    float pX = hasPivot ? this.mPivotX : w / 2.0f;
    float pY = hasPivot ? this.mPivotY : h / 2.0f;
    float rX = this.mRotationX;
    float rY = this.mRotationY;
    float rZ = this.mRotationZ;
    if (!(rX == 0.0f && rY == 0.0f && rZ == 0.0f)) {
        Camera camera = this.mCamera;
        camera.save();
        camera.rotateX(rX);
        camera.rotateY(rY);
        camera.rotateZ(-rZ);
        camera.getMatrix(m);
        camera.restore();
        m.preTranslate(-pX, -pY);
        m.postTranslate(pX, pY);
    }
    float sX = this.mScaleX;
    float sY = this.mScaleY;
    if (!(sX == 1.0f && sY == 1.0f)) {
        m.postScale(sX, sY);
        m.postTranslate((-(pX / w)) * ((sX * w) - w), (-(pY / h)) * ((sY * h) - h));
    }
    m.postTranslate(this.mTranslationX, this.mTranslationY);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:29,代碼來源:AnimatorProxy.java

示例8: drawIconThree

import android.graphics.Camera; //導入方法依賴的package包/類
/**
 * 根據角度繪製圖標的類
 * @param canvas 畫布
 * @param degree 角度
 * @param icon 圖標
 * @param width view寬度
 * @param height view高度
 */
private void drawIconThree(Canvas canvas, int degree, Bitmap icon, int width, int height) {
    Camera camera = new Camera();
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    int centerX = width / 2;
    int centerY = height / 2 - 200;
    int x = centerX - icon.getWidth()/2;
    int y = centerY - icon.getHeight()/2;
    Matrix matrix = new Matrix();
    matrix.postScale(1.7f, 1.7f, centerX, centerY);
    //繪製上半部分
    canvas.save();
    canvas.concat(matrix);
    canvas.clipRect(x, y, x + icon.getWidth(), y + icon.getHeight() / 2);
    canvas.drawBitmap(icon, x, y, paint);
    canvas.restore();

    //繪製下半部分
    canvas.save();
    canvas.concat(matrix);
    if (degree <= 90)
        canvas.clipRect(x, y, x + icon.getWidth(), y + icon.getHeight() / 2);
    else
        canvas.clipRect(x, y + icon.getHeight() / 2, x + icon.getWidth(), y + icon.getHeight());
    canvas.translate(centerX, centerY);
    camera.save();
    camera.rotateX(180 - degree);
    camera.applyToCanvas(canvas);
    camera.restore();
    canvas.translate(-centerX, -centerY);
    canvas.drawBitmap(icon, x, y, paint);
    canvas.restore();
}
 
開發者ID:JoshuaRogue,項目名稱:FancyView,代碼行數:41,代碼來源:RotationDrawStrategy.java

示例9: 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

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

示例11: applyTransformation

import android.graphics.Camera; //導入方法依賴的package包/類
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final Camera camera = mCamera;
    final Matrix matrix = t.getMatrix();
    final float fromDegrees = mFromDegrees;
    final float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    camera.save();
    camera.rotateX(degrees);
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-mCenterX, -mCenterY);
    matrix.postTranslate(mCenterX, mCenterY);
}
 
開發者ID:Ramotion,項目名稱:folding-cell-android,代碼行數:16,代碼來源:FoldAnimation.java

示例12: transformMatrix

import android.graphics.Camera; //導入方法依賴的package包/類
private void transformMatrix(Matrix m, View view) {
    final float w = view.getWidth();
    final float h = view.getHeight();
    final boolean hasPivot = mHasPivot;
    final float pX = hasPivot ? mPivotX : w / 2f;
    final float pY = hasPivot ? mPivotY : h / 2f;

    final float rX = mRotationX;
    final float rY = mRotationY;
    final float rZ = mRotationZ;

    if ((rX != 0) || (rY != 0) || (rZ != 0)) {
        final Camera camera = mCamera;
        camera.save();
        camera.rotateX(rX);
        camera.rotateY(rY);
        camera.rotateZ(-rZ);
        camera.getMatrix(m);
        camera.restore();
        m.preTranslate(-pX, -pY);
        m.postTranslate(pX, pY);
    }

    final float sX = mScaleX;
    final float sY = mScaleY;

    if ((sX != 1.0f) || (sY != 1.0f)) {
        m.postScale(sX, sY);
        final float sPX = -(pX / w) * ((sX * w) - w);
        final float sPY = -(pY / h) * ((sY * h) - h);
        m.postTranslate(sPX, sPY);
    }

    m.postTranslate(mTranslationX, mTranslationY);
}
 
開發者ID:michaelbel,項目名稱:material,代碼行數:36,代碼來源:View10.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 (mDirection == ROTATION_X)
        camera.rotateX(degrees);
    else
        camera.rotateY(degrees);

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

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);

    matrix.preScale(scaleType.getScale(scale, interpolatedTime),
                    scaleType.getScale(scale, interpolatedTime), centerX, centerY);
}
 
開發者ID:whereuat,項目名稱:whereuat-android,代碼行數:28,代碼來源:FlipAnimation.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();
    if (mReverse) {
        camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime);
    } else {
        camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime));
    }
    if (!mHorizontal) {
    	camera.rotateY(degrees);
    } else {
    	camera.rotateX(degrees);
    }
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
開發者ID:roadlabs,項目名稱:alternate-java-bridge-library,代碼行數:29,代碼來源:Rotate3dAnimation.java

示例15: 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(mVertical) {
    	camera.rotateY(degrees);
    } else {
    	camera.rotateX(degrees);
    }
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
開發者ID:androidertc,項目名稱:iLocker,代碼行數:29,代碼來源:Rotate3dAnimation.java


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