-1
我有一个800x480的图像,我想要一个缩放动画,以便图像缩放到960x576。我知道Android有一个ScaleAnimation
类,但我也希望用户能够暂停动画,同时缩放并从暂停的位置恢复。自定义比例动画
我该怎么做?
我写了一些自定义刷新循环,但它不像超级光滑的ScaleAnimation
类。自定义刷新循环仅计算每25毫秒所需的宽度和高度变化,然后将新宽度设置为Rect
。然后循环调用invalidate。
//Reset the image size
x = (x + dx);
y = (y + dy);
imageWidth = (imageWidth + dWidth);
imageHeight = (imageHeight + dHeight);
然后我画在画布上。
outputRect.set((int)(-x), (int)(-y), (int)imageWidth, (int)imageHeight);
canvas.drawBitmap(bitmap, srcRect, outputRect, paint);
我该怎么做才能像Android操作系统一样流畅或更有效?