Anchor point conversion

how can I change the Anchor point and the position of a GUI such that it will remain in the same position.
Ex
Initial AnchorPoint = 0.5, 0.5
Initial Position = 0.5, 0, 0.5, 0

Final AnchorPoint = 0, 0
Final Position = ??
and the GUI should remain in the same position on the screen

Assuming the initial anchor point is xa1, ya1, final anchor point is xa2, ya2 and the initial position is x1, 0, y1, 0, you can get the final position’s x and y scale components like this:
x = x1 + xa2 - xa1
y = y1 + ya2 - ya1

This will give you the final position
x, 0, y, 0
which will result in the same absolute position as the original situation when used with the final AnchorPoint xa2, ya2.

1 Like