local ed = Enum.EasingDirection;
local es = Enum.EasingStyle;
local g: any = game;
local GS: any = g.GetService;
local P: Players = GS(g, 'Players');
local TS: TweenService = GS(g, 'TweenService');
local RSS: ReplicatedStorage = GS(g, 'ReplicatedStorage');
local Fetch = require(RSS:WaitForChild('Fetcher', 30.0));
local MouseInteraction, PlaySound = Fetch:Event({ ':MouseInteraction()', ':PlaySound()' });
local Debounce, Database, Find, PopUp, Check = Fetch:Script({ 'Debouncer', 'DatabaseManager', 'Recursiver', 'PopUpManager', 'Checker' });
local TI1 = TweenInfo.new(0.5, es.Circular, ed.Out);
local TI2 = TweenInfo.new(0.5, es.Circular, ed.Out);
local TI3 = TweenInfo.new(0.50, es.Circular, ed.Out);
-- local TI4 = TweenInfo.new(5.0, es.Quad, ed.Out);
-- local TI5 = TweenInfo.new(4.0, es.Quad, ed.Out);
local TI6 = TweenInfo.new(0.8, es.Quad, ed.Out);
local TI7 = TweenInfo.new(1.5, es.Quint, ed.InOut);
local TweenSettings1 = { Position = UDim2.new(-0.150, 0, -0.3640, 0) };
local TweenSettings2 = { Position = UDim2.new(0.5920, 0, -0.3640, 0) };
local TweenSettings3 = { Size = UDim2.new(0.30, 0, 0.05, 0) }
local TweenSettings4 = { Position = UDim2.new(0.50, 0, 0.05, 0) }
local TweenSettings5 = { Size = UDim2.new(0.6, 0, 0.6, 0) }
local TweenSettings6 = { Position = UDim2.new(0.5, 0, 0.5, 0) };
local TweenSettings7 = { Position = UDim2.new(1.31, 0, 0.50, 0) };
local TweenSettings8 = { Position = UDim2.new(1.16, 0, 0.05, 0) };
local OriginalSizeY;
local TransparencyTable = { };
local FadeTweens = { };
local PropertyMap = {
[' O'] = 'Transparency',
[' I'] = 'ImageTransparency',
[' T'] = 'TextTransparency',
[' TS'] = 'TextStrokeTransparency',
[' BG'] = 'BackgroundTransparency',
[' SB'] = 'ScrollBarImageTransparency',
};
local function Play(Player: Player, Sound: string)
PlaySound:FireClient(Player, Sound);
end
local function SizeAnimation(Button: any, Amplification: number)
local SizeX = Button.Parent.Size.X.Scale;
local SizeY = OriginalSizeY or Button.Parent.Size.Y.Scale;
OriginalSizeY = SizeY;
Button.Parent:TweenSize(UDim2.new(SizeX, 0, SizeY * Amplification, 0), ed.InOut, es.Quint, 0.2, false);
end
function AddFadeTween(Element: any, Key: string, IsMinimized: boolean, Type: string)
local Settings = { };
local DefaultValue = 1.0;
if IsMinimized then
DefaultValue = TransparencyTable[Key] or 1.0;
end
local Property = PropertyMap[Type];
if Property then
Settings[Property] = DefaultValue;
table.insert(FadeTweens, TS:Create(Element, TI6, Settings));
end
end
function Animate(LP: Player, CallType: number, Button: any, PopUpName: string, EventName: string, GFX: boolean, Method: (any?) -> any?)
local PlayerPopUp, Shader, _, _ = PopUp:Get(LP, PopUpName);
local Frame = Button.Parent.Parent;
local CloseFrame, MinimizeFrame, CloseButton, MinimizeButton, Minimized, Title = Check:ForInstance({ 'Close', 'Minimize', 'CloseButton', 'MinimizeButton', 'Minimized', 'Title' }, Frame, true, 'Unpacked');
local Separator, UIGradient, UICorner, UIStroke = Check:ForInstance({ 'Separator', 'UIGradient', 'UICorner', 'UIStroke' }, Frame, false, 'Unpacked');
local IsMinimized = Minimized.Value;
local function ChangeState(SizeSettings: { }, PositionSettings: { }, SizeX: number, SizeY: number, Text: string)
Debounce('PopUp', 2.0);
local SizeTween = TS:Create(Frame, TI6, SizeSettings);
local PositionTween = TS:Create(Frame, TI6, PositionSettings);
local SeparatorTween = TS:Create(Separator, TI6, { Size = UDim2.new(SizeX, 0, 0, 0) });
local AdditionalTweens = {
TS:Create(CloseFrame, TI6, { Size = UDim2.new(0.1, 0, SizeY, 0) }),
TS:Create(MinimizeFrame, TI6, { Size = UDim2.new(0.1, 0, SizeY, 0) }),
TS:Create(Title, TI6, { Size = UDim2.new(0.76, 0, SizeY, 0) }),
TS:Create(UICorner, TI6, { CornerRadius = UDim.new(SizeY, 0) }),
};
OriginalSizeY = SizeY;
for _, Element in ipairs (Frame:GetDescendants()) do
local Parent = Element.Parent or '';
if (Parent ~= Frame and Parent ~= CloseFrame and Parent ~= MinimizeFrame and Parent ~= Separator) then
for Suffix, Property in pairs(PropertyMap) do
local HasProperty, Value = table.unpack(Check:ForProperty({ Element }, Property));
if HasProperty then
local Key = Element.Name .. Suffix;
AddFadeTween(Element, Key, IsMinimized, Suffix);
TransparencyTable[Key] = Value;
end
end
end
end
if IsMinimized then
PositionTween:Play();
PositionTween.Completed:Wait();
SizeTween:Play();
task.wait(TI6.Time / 8);
Separator.Visible = true;
SeparatorTween:Play();
for i, Tween in ipairs(AdditionalTweens) do
Tween:Play();
if #AdditionalTweens == i then
Tween.Completed:Wait();
end
end
MinimizeButton.Text = Text;
for i, Tween in ipairs(FadeTweens) do
Tween:Play();
end
else
SeparatorTween:Play();
for i, Tween in ipairs(FadeTweens) do
Tween:Play();
if #FadeTweens == i then
Tween.Completed:Wait();
end
end
SizeTween:Play();
for i, Tween in ipairs(AdditionalTweens) do
Tween:Play();
if #AdditionalTweens == i then
Tween.Completed:Wait();
end
end
MinimizeButton.Text = Text;
SizeTween.Completed:Wait();
PositionTween:Play();
end
table.clear(FadeTweens);
table.clear(AdditionalTweens);
task.wait(TI6.Time / 4);
if not IsMinimized then
Separator.Visible = false;
end
Minimized.Value = not Minimized.Value;
PopUp:DisableShader(Shader, GFX);
end
local function Close()
Debounce('PopUp', 3.0);
local Tween;
if IsMinimized then
Tween = TS:Create(Frame, TI7, TweenSettings8);
else
Tween = TS:Create(Frame, TI7, TweenSettings7);
end
Tween:Play();
task.wait(1.0);
PopUp:DisableShader(Shader, GFX);
task.spawn(function()
task.wait(1.5)
if IsMinimized then
ChangeState(TweenSettings5, TweenSettings6, 0.95, 0.1, '-');
end
Frame.Visible = false;
end);
end
local function TweenSlider()
Debounce('SettingChange', 0.5);
local Circle = Button.Parent.Circle;
local SettingName = Circle.Parent.Parent.Name;
local Setting = Fetch:Setting(LP, 'Settings', { SettingName });
local SettingObject = RSS:WaitForChild('Players', 30.0):WaitForChild(tostring(LP.UserId), 30.0).Settings.Audiovisual:WaitForChild(SettingName, 30.0);
local Enabled = SettingObject.Value;
if GFX then
local Tween1 = TS:Create(Circle, TI1, TweenSettings1);
local Tween2 = TS:Create(Circle, TI2, TweenSettings2);
local function AnimateColor(ColorN: Color3)
local TweenSettings3 = {
BackgroundColor3 = ColorN
};
local Tween3 = TS:Create(Circle, TI3, TweenSettings3);
Tween3:Play();
end
if Enabled then
AnimateColor(Color3.fromRGB(188.0, 137.0, 225.0));
Tween1:Play()
else
AnimateColor(Color3.fromRGB(119.0, 225.0, 207.0));
Tween2:Play()
end
else
if Enabled then
Circle.Position = UDim2.new(-0.150, 0.0, -0.3640, 0.0);
Circle.BackgroundColor3 = Color3.fromRGB(188.0, 137.0, 225.0);
else
Circle.Position = UDim2.new(0.5920, 0.0, -0.3640, 0.0);
Circle.BackgroundColor3 = Color3.fromRGB(119.0, 225.0, 207.0);
end
end
SettingObject.Value = not SettingObject.Value;
end
if CallType == 0.0 then
SizeAnimation(Button, 1.050);
elseif CallType == 2.0 then
SizeAnimation(Button, 0.950);
elseif CallType >= 1.0 then
SizeAnimation(Button, 1.0);
if CallType == 1.5 then
if EventName == 'Close' then
Close();
elseif EventName == 'Minimize' then
if IsMinimized then
ChangeState(TweenSettings5, TweenSettings6, 0.95, 0.1, '-');
else
ChangeState(TweenSettings3, TweenSettings4, 0.0, 1.0, '+');
end
elseif EventName == 'Slide' then
TweenSlider();
else
MouseInteraction:FireServer(EventName);
end
end
end
end
return Animate;