Defining Tweens & Animations

Hey Developers, so I’m working on an admin panel and of course, it involves tweening with buttons, etc I’ve looked into a couple of other open-source admin panels & systems to see how they format scripts and how it functions.

On a couple, I’ve seen they define the tween so like

local ScalingTweenInfo = TweenInfo.new(0.2, Enum.EastingStyle.Quint
local FadeTweenInfo = TweenInfo.new(0.2, Enum.EastingStyle.Linear

and I know how to define and all but how would I apply it to a tween? What I usually do when I tween buttons are

local Button = script.parent etc etc
local Frame = script.parent etc etc

Button.MouseButton1Click:Connect(function()
Frame:TweenPosition(UDim2.new(0.303, 0 ,0.045, 0),‘Out’, ‘Sine’, 0.5)
end)

They used https://developer.roblox.com/en-us/api-reference/class/TweenService.
instead of gui:TweenPosition() or Gui:TweenSize()

You can do the same with gui:Tween()

like this

local info = {

UDim2.new(0.303, 0 ,0.045, 0),

"Out", 

"Sine", 

0.5

}

gui:TweenPosition(unpack(info))

So how would I coordinate or refurbish my code that I usually use to match with the info etc

local info = {

UDim2.new(0.303, 0 ,0.045, 0), --argument 1

"Out", --argument 2

"Sine", --argument 3

0.5 --argument 4

}

gui:TweenPosition(unpack(info)) -- this will run the tween with the info form the table.

You could just use TweenService and use TweenInfo.