假设一张图片有
Height = 200px;
Width = 100px;
图像中的一个点有
Y axis = 40px
X axis = 30px
现在,如果我调整该图像的大小:
New Height = 300px;
New Width = 150px;
Is there any formula to calculate new Y and X axis of that point?
最佳答案
坐标变化的因素是:
xFactor = newSizeX/OldSizeX = 150/100 = 3/2
yactor = newSizeY/OldSizeY = 300/200 = 3/2
newX 坐标 = oldXCorrdainte*xFactor = 30*3/2 = 45
newY 坐标 = oldXCorrdainte*xFactor = 40*3/2 = 60
关于css - 拉伸(stretch)时如何计算图像内对象的x和y?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39291751/