nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 28 Sep 2015 02:50 PM |
"RadiusCutoff"
It means when the distance to the mouse doesn't matter anymore. If you set it to 300, then after 300 pixels from the center of the GUI, its size won't change. |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2015 02:51 PM |
| @nox problem spotted, the icons move left outside of the holder! |
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 28 Sep 2015 02:52 PM |
"problem spotted, the icons move left outside of the holder!"
They're supposed to bubble outside of the holder. I used your exact model you gave me and, when I fixed that one line, nothing seemed wrong. |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2015 02:53 PM |
local Mouse = game.Players.LocalPlayer:GetMouse( )
local MagnifiableObjects = { }
local function RegisterGUI( GUI, MaxMagnificationFactor, RadiusCutoff ) MagnifiableObjects[ GUI ] = { MaxMagnificationFactor, RadiusCutoff, GUI.AbsoluteSize, (not GUI.Parent:IsA("GuiBase")) and GUI.AbsolutePosition or (GUI.Parent.AbsolutePosition - GUI.AbsolutePosition) } end
Mouse.Move:connect( function( ) local X,Y = Mouse.X, Mouse.Y for GUI, Data in pairs( MagnifiableObjects ) do local GUICenter = GUI.AbsolutePosition + GUI.AbsoluteSize/2 local Size = GUI.AbsoluteSize local Distance = (Vector2.new(X,Y) - GUICenter).magnitude local SizePercentage = 1-(Distance/Data[2]) SizePercentage = SizePercentage > 0 and SizePercentage or 0 local ChangeFactor = Data[1] * SizePercentage ChangeFactor = ChangeFactor >= 1 and ChangeFactor or 1 local NewSize = Data[3] * ChangeFactor local NewPositionAdjustment = Data[4] - (NewSize - Data[3])/2 GUI.Size = UDim2.new(0,NewSize.X, 0, NewSize.Y) GUI.Position = UDim2.new(0,NewPositionAdjustment.X, 0, NewPositionAdjustment.Y) end end )
RegisterGUI(script.Parent.Taskbar.Icons.ShopButton, 1.5, 300) RegisterGUI(script.Parent.Taskbar.Icons.CashButton, 1.5, 300) RegisterGUI(script.Parent.Taskbar.Icons.SettingsButton, 1.5, 50)
This is what I did but the icons move all the way to the left. |
|
|
| Report Abuse |
|
|
| |
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 28 Sep 2015 02:58 PM |
My bad again. I didn't account for sign differences.
] = { MaxMagnificationFactor, RadiusCutoff, GUI.AbsoluteSize, (not GUI.Parent:IsA("GuiBase")) and GUI.AbsolutePosition or ( Vector2.new(math.max(GUI.Parent.AbsolutePosition.X, GUI.AbsolutePosition.X) - math.max(GUI.Parent.AbsolutePosition.Y, GUI.AbsolutePosition.Y)) - Vector2.new(math.min(GUI.Parent.AbsolutePosition.X, GUI.AbsolutePosition.X) - math.min(GUI.Parent.AbsolutePosition.Y, GUI.AbsolutePosition.Y))) } |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2015 02:59 PM |
| @nox You thought I was a terrible scripter for a moment, didnt you :P |
|
|
| Report Abuse |
|
|