[Plugin] TweenLab — UI Tween Previewer

Hey everyone,

I wanted to share a plugin I’ve been working on called TweenLab.

If you do a lot of UI design or scripting, you probably know how annoying it is to keep hitting Play Test or running temporary scripts just to see if a button animation looks right or if an EasingStyle feels smooth. I got tired of doing that constantly, so I built this tool to preview UI tweens instantly inside Studio.

:fire: What it does

  • Instant Previews: You can test any animatable property (Size, Position, Rotation, Transparency, Colors, etc.) with whatever Duration, EasingStyle, and EasingDirection you want.
  • Safe Execution: When you run a preview, the plugin clones your UI element and tests the animation inside CoreGui. Your original elements aren’t touched at all, so nothing gets messed up.

:hammer_and_wrench: How to use it

  1. Select any UI element (like a Frame, Button, or TextLabel) in your Explorer.
  2. Choose the property you want to animate and type in your target value.
  3. Hit RUN PREVIEW to see it move, and press STOP PREVIEW whenever you want to go back.

:inbox_tray: Get it here

The plugin is fully open-source and written in clean Luau. Let me know if you have any feedback, bug reports, or suggestions for the next update.

Source Code

– =============================================================================
– PLUGIN: TweenLab Pro (Official Premium Dark Stack Edition)
– =============================================================================

local Selection = game:GetService(“Selection”)
local TweenService = game:GetService(“TweenService”)
local CoreGui = game:GetService(“CoreGui”)

– [1. إدارة الحالة المركزية المستقرة]
local activePreview = {
running = false,
screen = nil,
target = nil,
originalVisibility = true,
tweens = {}
}

– [2. إعداد شريط الأدوات والنافذة الجانبية]
local toolbar = plugin:CreateToolbar(“TweenLab Tools”)
local toggleButton = toolbar:CreateButton(“TweenLabToggle”, “Open TweenLab Panel”, “”, “TweenLab”)

local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Right, false, false, 240, 450, 180, 320)
local widget = plugin:CreateDockWidgetPluginGui(“TweenLabPanel”, widgetInfo)
widget.Title = “TweenLab UI Sandbox”

toggleButton.Click:Connect(function() widget.Enabled = not widget.Enabled end)
widget:GetPropertyChangedSignal(“Enabled”):Connect(function() toggleButton:SetActive(widget.Enabled) end)

– [3. بناء الواجهة الاحترافية بنمط Obsidian Stack الداكن]
local container = Instance.new(“ScrollingFrame”)
container.Size = UDim2.new(1, 0, 1, 0)
container.BackgroundColor3 = Color3.fromRGB(16, 16, 18) – خلفية داكنة عميقة وفخمة
container.BorderSizePixel = 0
container.ScrollBarThickness = 2
container.ScrollBarImageColor3 = Color3.fromRGB(45, 45, 50)
container.Parent = widget

local layout = Instance.new(“UIListLayout”)
layout.Padding = UDim.new(0, 12) – مسافات أوسع ومريحة بين العناصر
layout.HorizontalAlignment = Enum.HorizontalAlignment.Center
layout.SortOrder = Enum.SortOrder.LayoutOrder
layout.Parent = container

– تحديث مساحة التمرير ديناميكياً لمنع أي تقطيع
layout:GetPropertyChangedSignal(“AbsoluteContentSize”):Connect(function()
container.CanvasSize = UDim2.new(0, 0, 0, layout.AbsoluteContentSize.Y + 30)
end)

local padding = Instance.new(“UIPadding”)
padding.PaddingTop = UDim.new(0, 16)
padding.PaddingLeft = UDim.new(0, 12)
padding.PaddingRight = UDim.new(0, 12)
padding.Parent = container

– شريط الحالة العلوي الأنيق
local statusLabel = Instance.new(“TextLabel”)
statusLabel.Size = UDim2.new(1, 0, 0, 18)
statusLabel.BackgroundTransparency = 1
statusLabel.Text = “Select a UI Element to start”
statusLabel.TextColor3 = Color3.fromRGB(110, 112, 120)
statusLabel.TextSize = 12
statusLabel.Font = Enum.Font.GothamMedium
statusLabel.TextXAlignment = Enum.TextXAlignment.Left
statusLabel.LayoutOrder = 1
statusLabel.Parent = container

– [دالة مصنع العناصر للهيكلة الرأسية الحديثة]
local function createInputField(labelText, defaultText, layoutOrder)
local row = Instance.new(“Frame”)
row.Size = UDim2.new(1, 0, 0, 48) – حجم أكبر لاحتواء التصميم الرأسي
row.BackgroundTransparency = 1
row.LayoutOrder = layoutOrder
row.Parent = container

local label = Instance.new("TextLabel")
label.Size = UDim2.new(1, 0, 0, 16)
label.BackgroundTransparency = 1
label.Text = labelText:upper() -- تحويل النص إلى كابيتال لمظهر تقني جاد
label.TextColor3 = Color3.fromRGB(135, 138, 145) -- لون رمادي ناعم للعناوين
label.TextSize = 10
label.Font = Enum.Font.GothamBold
label.TextXAlignment = Enum.TextXAlignment.Left
label.Parent = row

local textBox = Instance.new("TextBox")
textBox.Size = UDim2.new(1, 0, 0, 28)
textBox.Position = UDim2.new(0, 0, 0, 20)
textBox.BackgroundColor3 = Color3.fromRGB(24, 24, 28) -- تباين ممتاز وخلفية متناسقة للخانات
textBox.Text = defaultText
textBox.TextColor3 = Color3.fromRGB(245, 245, 250)
textBox.TextSize = 12
textBox.Font = Enum.Font.Code
textBox.ClearTextOnFocus = false
textBox.Parent = row

local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 4)
corner.Parent = textBox

local stroke = Instance.new("UIStroke")
stroke.Color = Color3.fromRGB(38, 38, 44)
stroke.Thickness = 1
stroke.Parent = textBox

-- تأثير التركيز عند النقر داخل الخانة
textBox.Focused:Connect(function() stroke.Color = Color3.fromRGB(100, 105, 115) end)
textBox.FocusLost:Connect(function() stroke.Color = Color3.fromRGB(38, 38, 44) end)

return textBox

end

– بناء الحقول بالهيكلة الفخمة الجديدة
local inputDuration = createInputField(“Duration (Seconds)”, “0.5”, 2)
local inputStyle = createInputField(“Easing Style”, “Back”, 3)
local inputDirection = createInputField(“Easing Direction”, “Out”, 5)
local inputProperty = createInputField(“Property Name”, “Size”, 7)
local inputTargetVal = createInputField(“Target Value”, “0, 150, 0, 150”, 9)

– [4. نظام القوائم المنسدلة المدمجة تحت الخانات مباشرة]
local allDropdowns = {}
local function createDropdownMenu(targetTextBox, options, layoutOrder, onSelectCallback)
local dropdownFrame = Instance.new(“ScrollingFrame”)
dropdownFrame.Size = UDim2.new(1, 0, 0, 110)
dropdownFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 24)
dropdownFrame.BorderSizePixel = 0
dropdownFrame.CanvasSize = UDim2.new(0, 0, 0, #options * 26)
dropdownFrame.ScrollBarThickness = 3
dropdownFrame.ScrollBarImageColor3 = Color3.fromRGB(50, 50, 55)
dropdownFrame.Visible = false
dropdownFrame.LayoutOrder = layoutOrder
dropdownFrame.Parent = container

local sCorner = Instance.new("UICorner")
sCorner.CornerRadius = UDim.new(0, 4)
sCorner.Parent = dropdownFrame

local sStroke = Instance.new("UIStroke")
sStroke.Color = Color3.fromRGB(35, 35, 40)
sStroke.Parent = dropdownFrame

table.insert(allDropdowns, dropdownFrame)

local dLayout = Instance.new("UIListLayout")
dLayout.SortOrder = Enum.SortOrder.LayoutOrder
dLayout.Parent = dropdownFrame

for i, option in ipairs(options) do
	local optBtn = Instance.new("TextButton")
	optBtn.Size = UDim2.new(1, 0, 0, 26)
	optBtn.BackgroundTransparency = 1
	optBtn.Text = "   " .. option
	optBtn.TextColor3 = Color3.fromRGB(180, 185, 195)
	optBtn.TextSize = 12
	optBtn.Font = Enum.Font.Gotham
	optBtn.TextXAlignment = Enum.TextXAlignment.Left
	optBtn.LayoutOrder = i
	optBtn.Parent = dropdownFrame

	optBtn.MouseButton1Click:Connect(function()
		targetTextBox.Text = option
		dropdownFrame.Visible = false
		if onSelectCallback then onSelectCallback(option) end
	end)

	optBtn.MouseEnter:Connect(function() 
		optBtn.BackgroundTransparency = 0
		optBtn.BackgroundColor3 = Color3.fromRGB(30, 30, 36) 
		optBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
	end)
	optBtn.MouseLeave:Connect(function() 
		optBtn.BackgroundTransparency = 1 
		optBtn.TextColor3 = Color3.fromRGB(180, 185, 195)
	end)
end

targetTextBox.Focused:Connect(function()
	for _, db in ipairs(allDropdowns) do db.Visible = false end
	dropdownFrame.Visible = true
end)

local isOverDropdown = false
dropdownFrame.MouseEnter:Connect(function() isOverDropdown = true end)
dropdownFrame.MouseLeave:Connect(function() isOverDropdown = false end)

targetTextBox.FocusLost:Connect(function() 
	task.defer(function()
		if not isOverDropdown then dropdownFrame.Visible = false end
	end)
end)

end

local styles = {“Linear”, “Sine”, “Back”, “Quad”, “Cubic”, “Quart”, “Quint”, “Bounce”, “Elastic”, “Exponential”, “Circular”}
local directions = {“In”, “Out”, “InOut”}
local properties = {“Size”, “Position”, “Rotation”, “BackgroundTransparency”, “BackgroundColor3”, “TextTransparency”, “TextColor3”}

local propertyTemplates = {
[“Size”] = “0, 150, 0, 150”, [“Position”] = “0, 100, 0, 100”, [“Rotation”] = “45”,
[“BackgroundTransparency”] = “0.5”, [“BackgroundColor3”] = “255, 0, 0”, [“TextTransparency”] = “0.5”, [“TextColor3”] = “255, 255, 255”
}

createDropdownMenu(inputStyle, styles, 4)
createDropdownMenu(inputDirection, directions, 6)
createDropdownMenu(inputProperty, properties, 8, function(selectedProperty)
local template = propertyTemplates[selectedProperty]
if template then inputTargetVal.Text = template end
end)

– زر التحكم الرئيسي ذو التباين العالي الفاخر (Tactile Flat Light Button)
local actionBtn = Instance.new(“TextButton”)
actionBtn.Size = UDim2.new(1, 0, 0, 36)
actionBtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255) – أبيض ناصع ومطفي لكسر رتابة الألوان الفاقعة
actionBtn.Text = “RUN PREVIEW”
actionBtn.TextColor3 = Color3.fromRGB(16, 16, 18) – نص داكن عالي الوضوح
actionBtn.TextSize = 12
actionBtn.Font = Enum.Font.GothamBold
actionBtn.LayoutOrder = 10
actionBtn.AutoButtonColor = true
actionBtn.Parent = container

local btnCorner = Instance.new(“UICorner”)
btnCorner.CornerRadius = UDim.new(0, 4)
btnCorner.Parent = actionBtn

– [5. محرك الفحص والمعالجة الذكي للمدخلات]
local function parseCustomValue(propName, text)
propName = string.lower(propName)
local numbers = {}
for num in string.gmatch(text, “[%d%.%-]+”) do
table.insert(numbers, tonumber(num))
end

if propName == "size" or propName == "position" then
	if #numbers == 4 then return UDim2.new(numbers[1], numbers[2], numbers[3], numbers[4]) end
elseif string.find(propName, "color3") then
	if #numbers == 3 then return Color3.fromRGB(numbers[1], numbers[2], numbers[3]) end
elseif text == "true" then return true
elseif text == "false" then return false
end
return tonumber(text) or text

end

– [6. نظام رصد وتأمين العناصر المستهدفة]
local lockedTarget = nil
local function updateSelection()
if activePreview.running then return end
local currentSelection = Selection:Get()
if #currentSelection == 0 then
if lockedTarget then
statusLabel.Text = "Target Locked: " .. lockedTarget.Name
statusLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
end
return
end
if #currentSelection == 1 then
local obj = currentSelection[1]
if obj:IsA(“GuiObject”) or obj:IsA(“ScreenGui”) then
lockedTarget = obj
statusLabel.Text = "Target Locked: " .. lockedTarget.Name
statusLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
else
statusLabel.Text = “Status: Invalid UI Element Selected”
statusLabel.TextColor3 = Color3.fromRGB(220, 70, 70)
end
else
statusLabel.Text = “Status: Select only one element”
statusLabel.TextColor3 = Color3.fromRGB(220, 70, 70)
end
end

local selectionConnection = Selection.SelectionChanged:Connect(updateSelection)
updateSelection()

– [7. محرك تشغيل ومعاينة الأنميشن الفوري]
local function resetUIBtnToIdle()
actionBtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
actionBtn.TextColor3 = Color3.fromRGB(16, 16, 18)
actionBtn.Text = “RUN PREVIEW”
end

local function stopPreview()
if not activePreview.running then return end
for _, tween in ipairs(activePreview.tweens) do if tween then tween:Cancel() end end
activePreview.tweens = {}
if activePreview.screen then activePreview.screen:Destroy() activePreview.screen = nil end
if activePreview.target and activePreview.target.Parent then
local isScreen = activePreview.target:IsA(“ScreenGui”)
activePreview.target[isScreen and “Enabled” or “Visible”] = activePreview.originalVisibility
end
resetUIBtnToIdle()
activePreview.running = false
updateSelection()
end

local function runPreview()
if activePreview.running then stopPreview() return end
if not lockedTarget or not lockedTarget.Parent then
statusLabel.Text = “Status: No element locked”
statusLabel.TextColor3 = Color3.fromRGB(220, 70, 70)
return
end

activePreview.running = true
activePreview.target = lockedTarget

local isScreenGui = lockedTarget:IsA("ScreenGui")
local visibilityProperty = isScreenGui and "Enabled" or "Visible"
activePreview.originalVisibility = lockedTarget[visibilityProperty]
lockedTarget[visibilityProperty] = false

actionBtn.BackgroundColor3 = Color3.fromRGB(210, 55, 55) -- أحمر صلب نظيف عند الإيقاف
actionBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
actionBtn.Text = "STOP PREVIEW"

local tempScreen = Instance.new("ScreenGui")
tempScreen.Name = "TweenLabPreviewContainer"
tempScreen.DisplayOrder = 999999
tempScreen.Parent = CoreGui
activePreview.screen = tempScreen

local clone
local canvasGroup = Instance.new("CanvasGroup")
canvasGroup.Size = UDim2.new(1, 0, 1, 0)
canvasGroup.BackgroundTransparency = 1
canvasGroup.Parent = tempScreen

if isScreenGui then
	for _, child in ipairs(lockedTarget:GetChildren()) do 
		if child:IsA("GuiObject") then local c = child:Clone() c.Parent = canvasGroup end 
	end
	clone = canvasGroup
else
	clone = lockedTarget:Clone()
	clone.Visible = true
	clone.Parent = canvasGroup
end

local duration = tonumber(inputDuration.Text) or 0.5
local style = Enum.EasingStyle.Quad
pcall(function() style = Enum.EasingStyle[inputStyle.Text] end)
local direction = Enum.EasingDirection.Out
pcall(function() direction = Enum.EasingDirection[inputDirection.Text] end)

local finalTweenInfo = TweenInfo.new(duration, style, direction)
local propName = inputProperty.Text
local targetValue = parseCustomValue(propName, inputTargetVal.Text)

local goals = {}
goals[propName] = targetValue

task.wait(0.02)

local success, tween = pcall(function() return TweenService:Create(clone, finalTweenInfo, goals) end)

if success and tween then
	local fadeTween = TweenService:Create(canvasGroup, TweenInfo.new(0.1), {GroupTransparency = 0})
	table.insert(activePreview.tweens, tween)
	table.insert(activePreview.tweens, fadeTween)
	fadeTween:Play()
	tween:Play()

	tween.Completed:Connect(function()
		task.wait(0.05)
		if activePreview.running and activePreview.screen == tempScreen then stopPreview() end
	end)
else
	statusLabel.Text = "Status: Invalid Property/Value" 
	statusLabel.TextColor3 = Color3.fromRGB(220, 70, 70)
	lockedTarget[visibilityProperty] = activePreview.originalVisibility
	resetUIBtnToIdle()
	tempScreen:Destroy()
	activePreview.running = false
end

end

actionBtn.MouseButton1Click:Connect(runPreview)

– [8. نظام التنظيف التلقائي الذكي]
plugin.Unloading:Connect(function()
if selectionConnection then selectionConnection:Disconnect() end
if activePreview.running then stopPreview() end
if widget then widget:Destroy() end
local oldContainer = CoreGui:FindFirstChild(“TweenLabPreviewContainer”)
if oldContainer then oldContainer:Destroy() end
end)

How it looks


:speech_balloon: Feedback & Discussion I’d love to hear your thoughts, workflows, and any feature requests! What properties or features are you hoping to see supported in future updates?

Hopefully, this tool speeds up your UI workflow and helps you create some amazing, highly-responsive user experiences. Happy developing!

2 Likes