Package gongzibai. co. cc;
Import android. graphics. Matrix;
Import android. view. animation. AccelerateDecelerateInterpolator;
Import android. view. animation. Animation;
Import android. view. animation. Transformation;
Public class TV extends Animation {
Private int halfWidth;
Private int halfHeight;
@ Override
Public void initialize (int width, int height, int parentWidth,
Int parentHeight ){
// TODO Auto-generated method stub
Super. initialize (width, height, parentWidth, parentHeight );
SetDuration (800 );
SetFillAfter (true );
// Save the center of the View
HalfWidth = width/2;
HalfHeight = height/2;
SetInterpolator (new AccelerateDecelerateInterpolator ());
}
@ Override
Protected void applyTransformation (float interpolatedTime, Transformation t ){
// TODO Auto-generated method stub
Super. applyTransformation (interpolatedTime, t );
Final Matrix matrix = t. getMatrix ();
If (interpolatedTime <0.8 ){
Matrix. preScale (1 + 0.625f * interpolatedTime,
1-interpolatedTime/0.8f + 0.01f, halfWidth, halfHeight );
} Else {
Matrix. preScale (7.5f * (1-interpolatedTime), 0.01f, halfWidth,
HalfHeight );
}
}
}
-------- Used with the Timer:
MLinearLayout. startAnimation (new TVOffAnimation ());
New Timer (). schedule (new TimerTask (){
@ Override
Public void run (){
// TODO Auto-generated method stub
Android. OS. Process. killProcess (android. OS. Process. myPid ());
}
},1000 );
From the column of gongzibai