Java 如何在缩放之前找到缩放点?
我有一个视图和动画。我在Java 如何在缩放之前找到缩放点?,java,android,animation,math,geometry,Java,Android,Animation,Math,Geometry,我有一个视图和动画。我在3X和3Y上放大了这个视图 透视X和透视->视图中心 在缩放视图之前,我想找到一个点(左、上),该点已经缩放了值 How can i find this point? ->()------------------------ | ______________ | | | | |
3X
和3Y
上放大了这个视图
透视X和透视->视图中心
在缩放视图之前,我想找到一个点(左、上),该点已经缩放了值
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;
但轴心点是视图的中心。为什么不缩放他?缩放时枢轴点不移动-这就是枢轴点的点-所有东西都围绕它移动,但它保持在同一点上。