如何在Android中为GLSurfaceView制作动画

时间:2013-08-14 05:05:02

标签: android animation glsurfaceview

我看过this。但似乎GLSurfaceView可以通过scrollBy滚动,那么是否可以在ApiDemos / Rotate3DAnimation中应用3D转换(翻转)或类似的东西在GLSurfaceView上?

ApiDemos / Rotate3DAnimation的部分源代码如下:

@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);
}

0 个答案:

没有答案