generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Help simulating the macbook "Magnify" effect

Previous Thread :: Next Thread 
nox7 is not online. 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
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
28 Sep 2015 02:51 PM
@nox problem spotted, the icons move left outside of the holder!
Report Abuse
nox7 is not online. 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
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
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
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
28 Sep 2015 02:56 PM
@nox ^
Report Abuse
nox7 is not online. 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
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
28 Sep 2015 02:59 PM
@nox You thought I was a terrible scripter for a moment, didnt you :P
Report Abuse
Previous Thread :: Next Thread 
Page 3 of 3Go to page: 1, 2, [3] Prev
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image