Hello everyone!
Today i made this Ui Effect and i would appreciate some feedback for it.
This is how it looks:
And this is how it is scripted
local TweenService = game:GetService("TweenService")
local Button = script.Parent
local Frame = script.Parent.Parent.Frame
local DarkBackground = script.Parent.Parent.Background
local CloseButton = Frame.Close
local function openFrame()
Frame.Position = UDim2.new(0.5, 0, -2, 0)
Frame.Visible = true
local FrameTweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
local FrameTween = TweenService:Create(Frame, FrameTweenInfo, {Position=UDim2.new(0.5, 0, 0.5, 0)})
DarkBackground.Transparency = 1
DarkBackground.Visible = true
local DarkBackgroundTweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
local DarkBackgroundTween = TweenService:Create(DarkBackground, DarkBackgroundTweenInfo, {Transparency=0.6})
FrameTween:Play()
DarkBackgroundTween:Play()
end
local function closeFrame()
Frame.Position = UDim2.new(0.5, 0, 0.5, 0)
local FrameTweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local FrameTween = TweenService:Create(Frame, FrameTweenInfo, {Position=UDim2.new(0.5, 0, -2, 0)})
DarkBackground.Transparency = 0.6
local DarkBackgroundTweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local DarkBackgroundTween = TweenService:Create(DarkBackground, DarkBackgroundTweenInfo, {Transparency=1})
FrameTween:Play()
DarkBackgroundTween:Play()
FrameTween.Completed:Connect(function()
Frame.Visible = false
end)
DarkBackgroundTween.Completed:Connect(function()
DarkBackground.Visible = false
end)
end
Button.MouseButton1Click:Connect(function()
if Frame.Visible == true then
closeFrame()
else
openFrame()
end
end)
CloseButton.MouseButton1Click:Connect(closeFrame)
Sincerely,
CSJeverything