Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Library = {
- windowCount = 0;
- };
- local dragger = {};
- local resizer = {};
- do
- local UserInputService = game:GetService("UserInputService");
- local heartBeat = game:GetService("RunService").Heartbeat;
- local TweenService = game:GetService("TweenService");
- local mouse = game:GetService("Players").LocalPlayer:GetMouse();
- function dragger.new(frame)
- local success, event = pcall(function()
- return frame.MouseEnter;
- end);
- assert(success, "#1 Expected UI element got "..frame.ClassName);
- frame.Active = true;
- event:Connect(function()
- local input = frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- local objectPosition = Vector2.new(mouse.X - frame.AbsolutePosition.X, mouse.Y - frame.AbsolutePosition.Y);
- while heartBeat:Wait() and UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
- frame:TweenPosition(UDim2.new(0, mouse.X - objectPosition.X + (frame.Size.X.Offset * frame.AnchorPoint.X), 0, mouse.Y - objectPosition.Y + (frame.Size.Y.Offset * frame.AnchorPoint.Y)), 'Out', 'Quad', 0.1, true);
- end;
- end
- end);
- local leave;
- leave = frame.MouseLeave:Connect(function()
- input:Disconnect();
- leave:Disconnect();
- end);
- end);
- end;
- function resizer.new(p, s)
- p:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
- s.Size = UDim2.new(s.Size.X.Scale, s.Size.X.Offset, s.Size.Y.Scale, p.AbsoluteSize.Y);
- end);
- end;
- function Library:ServiceTween(object, info, goals)
- assert(object, '#1 GUI object expected got nil');
- return TweenService:Create(object, TweenInfo.new(unpack(info)), goals);
- end
- function Library:Tween(object, Type,goals)
- assert(object, "#1 Expceted gui object got nil");
- if Type == "SP" then
- object:TweenSizeAndPosition(unpack(goals));
- elseif Type == "S" then
- object:TweenSize(unpack(goals));
- elseif Type == "P" then
- object:TweenPosition(unpack(goals));
- else
- error('Invalid Type');
- end
- end;
- end;
- local defaults = {}; --default colours
- function Library:Create(class, props)
- local object = Instance.new(class);
- for i, v in pairs(props) do
- if i ~= "Parent" then
- object[i] = v;
- end;
- end;
- object.Parent = props.Parent;
- return object;
- end;
- function Library:CreateIntiation(options)
- assert(options, "#1 Table expected got nil");
- setmetatable(options, {__index = defaults}); -- inheritance :sunglasses:
- local window = {};
- Library.gui = Library.gui or self:Create("ScreenGui", {Name = "BrandonCoolio", Parent = game:GetService("CoreGui")});
- window.logoFrame = self:Create("ImageLabel", {
- BackgroundTransparency = 1;
- Size = UDim2.new(0, 0, 0, 0);
- Position = UDim2.new(0.5, 0, 0.5, 0);
- AnchorPoint = Vector2.new(0.5, 0.5);
- ImageColor3 = options.ImageColor3 or Color3.fromRGB(255, 255, 255);
- Image = 'rbxassetid://4132450915'; -- rbxassetid://282305376 rbxassetid://4387074074
- Parent = self.gui;
- });
- window.logo = self:Create("ImageLabel", {
- BackgroundTransparency = 1;
- Size = UDim2.new(0, 74, 0, 74);
- AnchorPoint = Vector2.new(0.5, 0.5);
- Position = UDim2.new(0, 0.5, 0, 0.5);
- Image = options.Logo;
- ImageTransparency = 2;
- Parent = window.logoFrame;
- });
- window.mainFrame = self:Create("Frame", {
- BorderSizePixel = 0;
- AnchorPoint = Vector2.new(0.5, 0.5);
- ZIndex = 1;
- Visible = false;
- BackgroundColor3 = Color3.fromRGB(54, 54, 54);
- Position = UDim2.new(0, -145,0, -86);
- Size = UDim2.new(0, 0, 0, 0);
- Parent = self.gui;
- });
- Library:Tween(window.logoFrame, 'SP', {UDim2.new(0, 100, 0, 100), UDim2.new(0.5, 0, 0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 0.8});
- wait(1);
- Library:ServiceTween(window.logo, {.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out}, {ImageTransparency = 0}):Play();
- wait(1);
- Library:Tween(window.logoFrame, 'SP', {UDim2.new(0, 0, 0, 0), UDim2.new(0.5, 0, 0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.7});
- Library:Tween(window.logo, 'SP', {UDim2.new(0, 0, 0, 0), UDim2.new(0.5, 0, 0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.7});
- wait(1);
- window.logo.Size = UDim2.new(0, 0, 0, 0);
- window.logo.Position = UDim2.new(0, -145,0, -86);
- Library:Tween(window.logo, 'S', {UDim2.new(0, 54,0, 54), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 0.4});
- Library:Tween(window.mainFrame, 'S', {UDim2.new(0, 341,0, 213), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.4});
- return window;
- end;
- return Library;
Advertisement
Add Comment
Please, Sign In to add comment