继承Animation

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);
    }
}

 

posted @ 2015-07-23 16:54  木头同学  阅读(237)  评论(0编辑  收藏  举报