/[projects]/android/Side9/src/dk/thoerup/side9/anim/Flip3dAnimation.java
ViewVC logotype

Annotation of /android/Side9/src/dk/thoerup/side9/anim/Flip3dAnimation.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1217 - (hide annotations) (download)
Mon Jan 24 22:21:23 2011 UTC (13 years, 4 months ago) by torben
File size: 1317 byte(s)
- Added flip animation of pictures in Picture View
- Marked OVerview activity as a launcher act. so it can be found in the phone's app launcher 
- Default values for "Show caption" and "save to sd" is now true.
- Bump version to 21
1 torben 1217 package dk.thoerup.side9.anim;
2    
3     import android.graphics.Camera;
4     import android.graphics.Matrix;
5     import android.view.animation.Animation;
6     import android.view.animation.Transformation;
7    
8     public class Flip3dAnimation extends Animation {
9     private final float mFromDegrees;
10     private final float mToDegrees;
11     private final float mCenterX;
12     private final float mCenterY;
13     private Camera mCamera;
14    
15     public Flip3dAnimation(float fromDegrees, float toDegrees, float centerX, float centerY) {
16     mFromDegrees = fromDegrees;
17     mToDegrees = toDegrees;
18     mCenterX = centerX;
19     mCenterY = centerY;
20     }
21    
22     @Override
23     public void initialize(int width, int height, int parentWidth, int parentHeight) {
24     super.initialize(width, height, parentWidth, parentHeight);
25     mCamera = new Camera();
26     }
27    
28     @Override
29     protected void applyTransformation(float interpolatedTime, Transformation t) {
30     final float fromDegrees = mFromDegrees;
31     float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);
32    
33     final float centerX = mCenterX;
34     final float centerY = mCenterY;
35     final Camera camera = mCamera;
36    
37     final Matrix matrix = t.getMatrix();
38    
39     camera.save();
40    
41     camera.rotateY(degrees);
42    
43     camera.getMatrix(matrix);
44     camera.restore();
45    
46     matrix.preTranslate(-centerX, -centerY);
47     matrix.postTranslate(centerX, centerY);
48    
49     }
50    
51     }

  ViewVC Help
Powered by ViewVC 1.1.20