Responsive Scale + Offset Layout
Combine percentage scaling, pixel offsets, and custom anchors (0.0 to 1.0). Layouts recalculate only on resize or hierarchy changes—never every frame.
Build responsive, animated interfaces in Kahlua with Fluent API, Spring Physics, Stack/Grid layouts, and zero FPS drops.
require "ProjectMotionUI/ProjectMotionUI"
require "ProjectMotionUI/Components/Window"
require "ProjectMotionUI/Components/Button"
require "ProjectMotionUI/Components/Label"
require "ProjectMotionUI/Layouts/StackLayout"
local function OpenMyModWindow()
local win = PMUI.Window:new("SURVIVOR TERMINAL", 360, 220)
:SetPositionPercent(0.5, 0.5)
:SetAnchor(0.5, 0.5)
:SetCornerRadius(8)
local body = PMUI.VBox:new()
:SetSizePercent(1.0, 1.0):SetSize(0, 0)
:SetPadding(16)
:SetGap(10)
win.content:AddChild(body)
body:AddChild(PMUI.Label:new("Welcome to ProjectMotionUI!", UIFont.Medium))
body:AddChild(
PMUI.Button:new("Trigger Spring Kick")
:SetSize(328, 38)
:ApplyStyle("PrimaryButton")
:OnClick(function(btn)
btn.anim:Impulse(350, -220, 220, 9)
end)
)
PMUI.CreateInstance("MyMod_MainWindow", win, true)
win.anim:FadeIn(0.25)
win.anim:SlideIn("top", 35, 0.3)
end