xPyroniz
|
  |
| Joined: 08 Sep 2015 |
| Total Posts: 68 |
|
|
| 18 Jan 2016 09:36 PM |
It's kinda annoying just trying diff positions over and over.
|
|
|
| Report Abuse |
|
|
Gensoki
|
  |
| Joined: 15 Feb 2014 |
| Total Posts: 1982 |
|
|
| 18 Jan 2016 09:38 PM |
| For scale 1 - X / 2 don't follow order of operations |
|
|
| Report Abuse |
|
|
xPyroniz
|
  |
| Joined: 08 Sep 2015 |
| Total Posts: 68 |
|
|
| 18 Jan 2016 09:38 PM |
The way you put that was a bit confused, so is it the X scale divided by 2, or..
|
|
|
| Report Abuse |
|
|
|
| 18 Jan 2016 09:40 PM |
I've developed the unique skill to subconsciously center any gui without any conscious mathematics.
Anyway, For scale 1 - X / 2 don't follow order of operations[2] |
|
|
| Report Abuse |
|
|
Gensoki
|
  |
| Joined: 15 Feb 2014 |
| Total Posts: 1982 |
|
|
| 18 Jan 2016 09:40 PM |
| Well if scale is out of one you do 1-X first and then divide by 2 to center the axis |
|
|
| Report Abuse |
|
|
|
| 18 Jan 2016 09:40 PM |
| http://forum.roblox.com/Forum/ShowPost.aspx?PostID=181948703 |
|
|
| Report Abuse |
|
|
xPyroniz
|
  |
| Joined: 08 Sep 2015 |
| Total Posts: 68 |
|
| |
|
xPyroniz
|
  |
| Joined: 08 Sep 2015 |
| Total Posts: 68 |
|
|
| 18 Jan 2016 09:43 PM |
Can I have a example? My GUI size is
0, 400, 0, 400
|
|
|
| Report Abuse |
|
|
| |
|
xPyroniz
|
  |
| Joined: 08 Sep 2015 |
| Total Posts: 68 |
|
| |
|
Gensoki
|
  |
| Joined: 15 Feb 2014 |
| Total Posts: 1982 |
|
|
| 18 Jan 2016 09:50 PM |
Actually this is more ugly but ok
local abssize = script.Parent.AbsoluteSize -- ScreenGUI Absolute Size in Pixels local abspos = script.Parent.AbsolutePosition -- ScreenGUI Absolute Position in Pixels local absx = abssize.x -- X Value of the Vector2 Absolute Size local absy = abssize.y -- Y Value of the Vector2 Absolute Size local abspositionx = abspos.x -- X Value of the Vector2 Absolute Position local abspositiony = abspos.y -- Y Value of the Vector2 Absolute Position local x = script.Parent:WaitForChild'Frame' -- The Frame local sizex = x.Size.X.Offset -- Frame's X Value from Offset of Size local sizey = x.Size.Y.Offset -- Frame's Y Value from Offset of Size
function updatevalues() abssize = script.Parent.AbsoluteSize abspos = script.Parent.AbsolutePosition absx = abssize.x absy = abssize.y abspositionx = abspos.x abspositiony = abspos.y x = script.Parent:WaitForChild'Frame' sizex = x.Size.X.Offset sizey = x.Size.Y.Offset end
while wait() do local newsizex = absx * 0.1 -- 10% of the screengui which covers the whole entire screen (x) local newsizey = absy * 0.1 -- 10% of the screengui which coverse the whole entire screen (y) local newposx = (absx - sizex) / 2 -- Takes Full Size then divides it by half to bring it to the center of screen (x) local newposy = (absy - sizey) / 2 -- Takes Full Size then divides it by half to bring it to the center of screen (y) script.Parent.Frame.Size = UDim2.new(0, newsizex, 0, newsizey) -- The new Size script.Parent.Frame.Position = UDim2.new(0, newposx, 0, newposy) -- The new Position updatevalues() end
Lol never thought this post would be useful |
|
|
| Report Abuse |
|
|