My application has 9 bitmap images on it in a 3x3 grid. All of them are showing on the screen and depending on how the user interacts with them (tap, double tap, pinch, zoom, drag) the image that is "action-ed on" needs to perform different tasks.
So for example, if I tap on one image, it needs to rotate around the it's vertical access completely, then stop.
Currently i'm using SurfaceView with the onTouchEvent(..) method. The way I figured I could animate this is by scaling the image's width from 1 to -1 back to 1. I've been trying to use a matrix, but I can't get the image to stay centered in it's spot. Please help me fix this or suggest an alternate/better way of accomplishing this.
My current code is just a test. If b is true, then the method will attempt to scale the bitmap. If b is false then it will draw the bitmap normally.:
public void doDraw(Canvas canvas, boolean b)
{
Matrix m = new Matrix();
float scale = .5f;
m.setScale(scale, 1f);
m.postTranslate(mX,mY);
if(!b)
canvas.drawBitmap(mBitmap, mX, mY, null);
else
canvas.drawBitmap(mBitmap, m, null);
}