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 view. is it possible ? I have seen some example for the flip in android. But in that all example the view is in the same activity. Is it possible to set such view for the different activity. or to do such effect while going from one activity to another ?
Please see the snap for the Flip effect in iPhone:
If Yes then please give reference to any demo example or code. Thanks.
You can flip a layout by setting the View property scaleX to -1. So View#setScaleX(1f) is normal, and View#setScaleX(-1f) is flipped (visually). To do it pre-Honeycomb, you can use scale properties in the general Animation library.
Crossfade animations (also know as dissolve) gradually fade out one UI component while simultaneously fading in another. This animation is useful for situations where you want to switch content or views in your app. Crossfades are very subtle and short but offer a fluid transition from one screen to the next.
Android's transition framework allows you to animate all kinds of motion in your UI by simply providing the starting layout and the ending layout.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With