Hi,
I am trying to set the anchor point of a bitmap to a point that is beyond the object, and located inside another bitmap. The current method that I am trying to do right now is to find the difference between their x and y positions and then dividing it by the first bitmap's widths and heights to find the exact anchor point relative to said bitmap. This method however, does not work and I was wondering if there is a way to set the anchor point to a coordinate or if someone knows an algorithm that converts a coordinate pair (x,y) to an anchor point of a bitmap.
For example, if the bitmap was at (25, 25), and the anchorpoint we want it to be at is (65, 65), what would we need Bitmap:setAnchorPoint(a, b) to be? And by changing the anchorpoint we would also change the position so the first bitmap would no longer be at (25, 25), right?! Hopefully this is not too confusing and someone on here can help me out! Thanks.
Comments
EDIT:
Wow it seems it actually can.
if your bitmap is at (25,25) like with (0,0) anchor point, and you want the anchor point to be at (65, 65) coordinate, it means you want to move anchor point by (40,40) pixels. And we need to calculate how much in precentage 40 pixels is from the height and width of your bitmap
So something like this should work:
Please tell more what exactly do you want to achieve.
The code I provided is more meant like if you want to set the coordinate of Bitmap to (25, 25) but want it to appear at (65, 65) coordinate.
Likes: Seebal, ar2rsawseen