007egleagent

roact6

Oct 14th, 2020
608
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage") --replicatedStorage
  2. local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  3. local Roact = require(game.ReplicatedStorage.Roact)
  4. local Otter = require(ReplicatedStorage.otter) --getting otter from RS
  5. local closeButton = require(script.Parent:WaitForChild("closeButton"))
  6.  
  7. local SettingsUi = Roact.Component:extend("SettingsUi")
  8.  
  9. function SettingsUi:init()
  10.     -- \\\\\ Creating motors for the animation with otter /////
  11.     -- MOTOR 1
  12.     self.originalPosition = Otter.createGroupMotor({
  13.         x=0,
  14.         y=0,
  15.     })
  16.     self.animation, self.movingAnimation = Roact.createBinding({
  17.         x=0,
  18.         y=0,
  19.     })
  20.  
  21.     self.originalPosition:onStep(function(values)
  22.         self.movingAnimation(values)
  23.     end)
  24. end
  25.  
  26. function SettingsUi:render()
  27.     return Roact.createElement("Frame",{
  28.         BackgroundTransparency = 1,
  29.         Size = UDim2.new(0.07, 0, 0.07, 0),
  30.     },{
  31.         settings = Roact.createElement("ImageLabel",{
  32.             Size = UDim2.fromScale(1, 1),
  33.             AnchorPoint = Vector2.new(1,1),
  34.             Image = "rbxassetid://5818077862",
  35.             SizeConstraint = "RelativeXX",
  36.             ScaleType = "Fit",
  37.             BackgroundTransparency = 1,
  38.             ZIndex = 2,
  39.  
  40.         }),
  41.         closeButton = Roact.createElement(closeButton,{
  42.             callback = function()
  43.                 callback = self.animation:map(function(values)
  44.                     return UDim2.new(values.x + 1.2, 0, values.y+1, 0)
  45.                 end)
  46.             end
  47.         })
  48.     })
  49. end
  50.  
  51. return SettingsUi
RAW Paste Data