In My application i want to flip the view.. I have seen such animation in iPhone. And Same thing i want in to my android application.
I want to flip the whole activity
At iOS portrait:
"A lot of the other tutorials and sample codes don't produce believable 3D flips. A simple rotation on the y-axis isn't what's done in iOS." After almost 30h searching for samples I have to agree. I have a movie, where I could take a screenshot at the middle. The right side of the view has: - a movement to left AND a shrink to 95%. The left side of the view has: - a movement to right side AND a shrink to 80%.
At Android Full ( initial state):
Android middle:
Android code:
// @param interpolatedTime The value of the normalized time (0.0 to 1.0)
// @param t The Transformation object to fill in with the current transforms.
protected void applyTransformation(float interpolatedTime, Transformation t){
float degrees = toDegree*interpolatedTime;
//float rad = (float) (degrees * Math.PI / 180.0f);
Matrix matrix = t.getMatrix();
camera.save();
camera.rotateY(degrees);
camera.getMatrix(matrix);
camera.restore();
matrix.preTranslate(-centerX, -centerY);// M' = M * T(dx, dy)
matrix.postTranslate(centerX, centerY); // M' = T(dx, dy) * M
}
An improved version of the code can be found in the most examples:
// @param interpolatedTime The value of the normalized time (0.0 to 1.0)
// @param t The Transformation object to fill in with the current transforms.
protected void applyTransformation(float interpolatedTime, Transformation t){
float degrees = toDegree*interpolatedTime;
//float rad = (float) (degrees * Math.PI / 180.0f);
Matrix matrix = t.getMatrix();
camera.save();
camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime);
camera.rotateY(degrees);
camera.getMatrix(matrix);
camera.restore();
matrix.preTranslate(-centerX, -centerY);// M' = M * T(dx, dy)
matrix.postTranslate(centerX, centerY); // M' = T(dx, dy) * M
}
Some differences are: - the right side of the view doesn't move as how the iOS.
Here is the Android Camera axes:
I do believe a traslation on Z axes doesn't fix it. Maybe needed a shrink too somehow.
float dz = (float) (centerX * Math.sin(rad));
camera.translate(0f, 0f, -dz);
Still not enough. To much is the shrink the left side.