package cativity.cyq.alphaanimal; import android.view.animation.Animation; import android.view.animation.Transformation; public class CustAnimation extends Animation { @Override public void initialize(int width, int height, int parentWidth, int parentHeight) { super.initialize(width, height, parentWidth, parentHeight); } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { t.getMatrix().setTranslate((float) Math.sin(interpolatedTime * 20) * 50, 0);//interpolatedTime从零到一逐渐变化 super.applyTransformation(interpolatedTime, t); } }