Android电视关闭的动画效果

public class TVOffAnimation extends Animation {

    private int halfWidth;

    private int halfHeight;

    @Override
    public void initialize(int width, int height, int parentWidth,
            int parentHeight) {

        super.initialize(width, height, parentWidth, parentHeight);
        setDuration(500);
        setFillAfter(true);

        halfWidth = width / 2;
        halfHeight = height / 2;
        setInterpolator(new AccelerateDecelerateInterpolator());
        
    }

    @Override
    protected void applyTransformation(float interpolatedTime, Transformation 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);
        }
    }
}

原文连接:http://gundumw100.iteye.com/blog/1311696
posted @ 2012-07-25 22:43  灰太狼_lilongmin  阅读(311)  评论(0编辑  收藏  举报