Hi,

I have been working on this for a while without any progress.:( And
sorry for the duplicate/cross posts:) Basically what I'd like to do is
like iPhone style zoom: user clicks on an image and it zooms in around
the touch point center, with animation applied; if user clicks
somewhere again on the image, it continues to zoom to the next level,
again around the touch point center.

I am using ImageView inside a LinearLayout and ScaleAnimation to do
this:

ScaleAnimation scalAnim = new ScaleAnimatin(curSX, nextSX, curSY,
curSY, Animation.RELATIVE_TO_SELF, pivotX,
Animation.RELATIVE_TO_SELF, pivotY);
animImageView.setAfterFill(true);
animImageView.setDuration(750);
animImageView.startAnimation(scalAnim);

I am using MotionEvent.getX()/getY() to assign to pivotX/Y. Of course
the code works only for the first touch. The pivot point is off for
the subsequent touches.

As I found out, MotionEvent.getX()/getY() actually return the pixel
values in the LinearLayout coordinate space (I implement
onTouchListener on my ImageView). My problem is that I don't
understand how to get the correct pivotX/Y values, by mapping getX()/
getY() into the imgeView's drawable coordinate space, as well as
getting the current width and height of the drawable which may have
transformation(s) applied, using the SDK API.

Or should I use
ScaleAnimation scalAnim = new ScaleAnimatin(curSX, nextSX, curSY,
curSY);
and manipulate underlying matrix within the onDraw() method of my
ImageView?

Obviously the following code is not working as expected. But I have no
clue as how to make it work. Again, I wish I better understood the
maths involved as well as how to implement it with the API:

Transformation outTrans = new Trasnformation();

scalAnim.getTransformation( System.currentTimeMillis(), outTrans );
Matrix m = outTrans.getMatrix();

m.preTranslate(-pX, -pY );//pX == MotionEvent.getX(); pY ==
MotionEvent.getY()
m.postTranslate(pX, pY );

canvas.concat( m );

myDrawable.draw( canvas );

Any guidance appreciated. Thanks much in advance!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to