How to find scaled point before scale?
I have a view and animation for that. I scaled up this view on 3X
and 3Y
.
pivotX and pivotY -> center of View
And i want to find a point(left,top), already scaled values, before i scale the view.
How can i find this point? ->()------------------------
| ______________ |
| | | |
| | 100x50 | |
| | | |
| -------------- |
| |
-------------------------
Note : coordinate system as [x : from left to right, y : from top to bottom]
你可以计算任何一点后的比例如下:
// 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/42604.html
上一篇: Android Animation ObjectAnimator从中心旋转
下一篇: 如何在缩放前查找缩放点?