Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Would this be the center of the following Size of the Gui?

Asked by 8 years ago

Size: {0.2, 0},{0.2, 0} Position: {0.4, 0},{0.4, 0}

1
Yes. Discern 1007 — 8y
0
Thx for the answer secretboy6 68 — 8y

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
8 years ago

The center of a frame (e.g. the screen) is always {0.5, 0}, {0.5, 0} -- since 50% across vertically/horizontally is the middle.

The .Position of a GUI is always its top-left-corner.

The .Size o fa GUI is always the amount across from the left to the right and the top to the bottom. So half way through the GUI is .Size / 2

A GUI is centered in the view if its center is the same as the containing frame's center. Meaning that {0.5, 0} {0.5, 0} = .Position +``.Size / 2

If you want to figure out the position for a given size, then it's just this, through basic algebra:

Position = {0.5, 0} {0.5, 0} - Size / 2

So, for a size (0.2, 0, 0.2, 0) object, you need (0.5, 0, 0.5, 0) - (0.2, 0, 0.2, 0) /2 = (0.5 - 0.1, 0, 0.5 - 0.1, 0) = (0.4, 0, 0.4, 0)

0
Thanks for explaining it! I used to know the formula, but I forgot all about it. lol. secretboy6 68 — 8y
Ad

Answer this question