I am trying to apply ScaleAnimation to a View , but I have a somewhat unconventional requirement: I would like to scale only a very specific view area.
Using the existing ScaleAnimation class, I can easily evenly scale the view. I can also set a pivot point at which to scale the view. The following is an example of this:

It's simple. But I want to achieve the following, which is associated with scaling only a certain area of ββthe view (or in this case a small horizontal rectangle in the middle of the emoticon):

I dug up the source code for ScaleAnimation , and the following function is apparently responsible for scaling:
protected void applyTransformation(float interpolatedTime, Transformation t) { float sx = 1.0f; float sy = 1.0f; if (mFromX != 1.0f || mToX != 1.0f) { sx = mFromX + ((mToX - mFromX) * interpolatedTime); } if (mFromY != 1.0f || mToY != 1.0f) { sy = mFromY + ((mToY - mFromY) * interpolatedTime); } if (mPivotX == 0 && mPivotY == 0) { t.getMatrix().setScale(sx, sy); } else { t.getMatrix().setScale(sx, sy, mPivotX, mPivotY); } }
Since this function simply applies the scaling operation to the matrix, I thought there was some kind of matrix operation that I could use to write a custom scaling animation, but I don't have the know-how in linear algebra. The solution to this can be much simpler, since others seem to have encountered this problem, but I could not find any solutions. Thanks in advance.
source share