what are the specific uses and uses of these two methods?
I checked Baidu and said it could rotate and correct the picture. I tried to feel that there was no difference between the two methods. The following is my code. I don"t know if it"s wrong.
final View view=findViewById(R.id.view_animation);
view.post(new Runnable() {
@Override
public void run() {
Log.d(TAG,"width:"+view.getX()+" height:"+view.getHeight());
CustomViewAnimation customViewAnimation=new CustomViewAnimation(view.getWidth()/2,view.getHeight()/2,10,50,80,true);
customViewAnimation.setDuration(3000);
customViewAnimation.setFillAfter(true);
view.startAnimation(customViewAnimation);
}
});
public CustomViewAnimation(float centerX,float centerY,float fromDegree,float toDegree,float depthZ,boolean reserve){
this.centerX=centerX;
this.centerY=centerY;
this.fromDegree=fromDegree;
this.toDegree=toDegree;
this.depthZ=depthZ;
this.reserve=reserve;
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
float degree=fromDegree+(toDegree-fromDegree)*interpolatedTime;
Matrix matrix=t.getMatrix();
camera.save();
Log.d(TAG,"interpolatedTime:"+interpolatedTime);
if(reserve){
camera.translate(0.0f,0.0f,depthZ*interpolatedTime);
}else{
camera.translate(0.0f,0.0f,depthZ*(1.0f-interpolatedTime));
}
camera.rotateY(degree);
camera.getMatrix(matrix);
camera.restore();
matrix.preTranslate(-centerX,-centerY);
matrix.postTranslate(centerX,centerY);
}