之前我写了一个对角线旋转的动画,但是那个需要继承View重写onDraw,感觉耦合度太高。
最近又看了一下Animation,发现可以不再onDraw里面重写绘制的流程,重写Animation.applyTransformation(float interpolatedTime, Transformation t)在t.getMatrix()获取矩阵来进行变换。优点是降低了耦合,减少了工作量;缺点是不能切割成很多个方块,只能一整个view一起变动。
代码Animation.applyTransformation
matrix3.postRotate(45);//顺时针旋转45度
protected void applyTransformation(float interpolatedTime, Transformatio