forked from apkdemo/andbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhaoqp2010
committed
Dec 11, 2013
1 parent
47033c0
commit 9572217
Showing
148 changed files
with
1,323 additions
and
642 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.ab.view.app; | ||
|
||
import android.graphics.Camera; | ||
import android.graphics.Matrix; | ||
import android.view.animation.Animation; | ||
import android.view.animation.Transformation; | ||
/** | ||
* | ||
* Copyright (c) 2012 All rights reserved | ||
* 名称:AbRotate3dAnimation2.java | ||
* 描述:TODO | ||
* @author 原作者 QQ:250333410 | ||
* @date:2013-12-11 上午11:36:37 | ||
* @version v1.0 | ||
*/ | ||
public class AbRotate3dAnimation2 extends Animation { | ||
private float mFromDegree; | ||
private float mToDegree; | ||
private float mCenterX; | ||
private float mCenterY; | ||
private float mLeft; | ||
private float mTop; | ||
private Camera mCamera; | ||
private static final String TAG = "Rotate3d"; | ||
|
||
public AbRotate3dAnimation2(float fromDegree, float toDegree, float left, float top, | ||
float centerX, float centerY) { | ||
this.mFromDegree = fromDegree; | ||
this.mToDegree = toDegree; | ||
this.mLeft = left; | ||
this.mTop = top; | ||
this.mCenterX = centerX; | ||
this.mCenterY = centerY; | ||
|
||
} | ||
|
||
@Override | ||
public void initialize(int width, int height, int parentWidth, | ||
int parentHeight) { | ||
super.initialize(width, height, parentWidth, parentHeight); | ||
mCamera = new Camera(); | ||
} | ||
|
||
@Override | ||
protected void applyTransformation(float interpolatedTime, Transformation t) { | ||
final float FromDegree = mFromDegree; | ||
float degrees = FromDegree + (mToDegree - mFromDegree) | ||
* interpolatedTime; | ||
final float centerX = mCenterX; | ||
final float centerY = mCenterY; | ||
final Matrix matrix = t.getMatrix(); | ||
|
||
if (degrees <= -76.0f) { | ||
degrees = -90.0f; | ||
mCamera.save(); | ||
mCamera.rotateY(degrees); | ||
mCamera.getMatrix(matrix); | ||
mCamera.restore(); | ||
} else if (degrees >= 76.0f) { | ||
degrees = 90.0f; | ||
mCamera.save(); | ||
mCamera.rotateY(degrees); | ||
mCamera.getMatrix(matrix); | ||
mCamera.restore(); | ||
} else { | ||
mCamera.save(); | ||
mCamera.translate(0, 0, centerX); | ||
mCamera.rotateY(degrees); | ||
mCamera.translate(0, 0, -centerX); | ||
mCamera.getMatrix(matrix); | ||
mCamera.restore(); | ||
} | ||
|
||
matrix.preTranslate(-centerX, -centerY); | ||
matrix.postTranslate(centerX, centerY); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.