如何在缩放前查找缩放点?

我有一个观点和动画。 我放大了3X3Y观点。

pivotX和pivotY - > View的中心

我想在缩放视图之前找到一个点(左边,顶部),已经缩放的值。

 How can i find this point? ->()------------------------
                               |    ______________     |
                               |    |            |     |
                               |    |   100x50   |     |
                               |    |            |     |
                               |    --------------     |
                               |                       |
                               -------------------------

注意:坐标系统为[x:从左到右,y:从上到下]


你可以计算任何一点后的比例如下:

// find the position relative to the pivot point
float relativeX = pointBeforeScale.x - pivotPoint.x; 
float relativeY = pointBeforeScale.y - pivotPoint.y;

// multiply the relative position by the scale
relativeX *= scale;
relativeY *= scale;

// add the pivot point to the result to get the absolute position.
float pointAfterScaleX = relativeX + pivotPoint.x;
float pointAfterScaleY = relativeY + pivotPoint.y;
链接地址: http://www.djcxy.com/p/42603.html

上一篇: How to find scaled point before scale?

下一篇: Android: Image buttons move when clicked for no reason