AtomicPane
The foundational model for all UI components in the game. Provides visibility controls, spring management, automatic alpha mapping, and more.
A VS Code snippet for creating AtomicPanes quickly is included with the Git repository.
NOTE
The source GUI objects should be located in
ReplicatedStorage.GuiTemplates. They can be of any GuiObject type.
Basic usage
local AtomicPane = shared("AtomicPane") ---@module AtomicPane
local ExamplePane = setmetatable({}, AtomicPane)
ExamplePane.__index = ExamplePane
ExamplePane.ClassName = "ExamplePane"
function ExamplePane:_draw()
local alpha = self._springs.Alpha.Position
self.Gui.Visible = alpha < 0.999
end
function ExamplePane.new(parent: Instance)
local self = setmetatable(AtomicPane.new("ExamplePaneTemplate", {}), ExamplePane)
self:SetVisible(false, true)
self.Gui.Parent = parent
return self
end
return ExamplePane
Properties
Gui
AtomicPane.Gui: FrameThe root GuiObject of a constructed AtomicPane
Maid
AtomicPane.Maid: MaidThe AtomicPane's dedicated Maid, which cleans up when the pane is destroyed, or a linked (see AtomicPane:Link()) parent pane is destroyed.
VisibleChanged
Fired when the visibility of the pane changes. Provides the new visibility state and whether the change was animated or instant.
Destroying
AtomicPane.Destroying: RBXScriptSignalFired when the pane is being destroyed.
Functions
Destroy
Destroys the AtomicPane and cleans up all maid tasks.
new
ConstructorAtomicPane.new(template: string | Instance,--
The name of a GuiObject in ReplicatedStorage.GuiTemplates or an existing instance to use as the pane's Gui.
instanceKeys: table--
A mapping of instance names to keys for quick access
) → ()Creates a new AtomicPane based on the template key or existing frame. Instances are mapped based on a simple descendants search, so unique names are required for consistency.
_draw
OverrideAtomicPane:_draw() → ()
An overridable function used to update the properties of various UI elements
using values from the _springs table.
Link
AtomicPane:Link(linkVisibility: boolean?--
Whether to link the visibility of this pane to the parent pane
) → ()Allows you to link this AtomicPane to another AtomicPane. This is useful to make sure that proper cleanup occurs when a parent pane is destroyed, for example.
MapAlpha
Caches the current transparency values of the specified instance and all its
descendants in an internal table for automatic interpolation based on the
Alpha spring.
SetSpring
AtomicPane:SetSpring(name: string,--
The name of the spring to modify
value: number,--
The target value to set the spring to
instant: boolean?--
Whether to instantly set the spring to the target value
) → ()
Sets the target value of a spring by name. Alpha is available by default.
AtomicButtons add Hovered, Pressed, Selected, and Enabled springs.
AddSpring
AtomicPane:AddSpring(name: string,--
The name of the spring to add
info: table--
The spring parameters to define the initial spring values, defaults to { s = 30, d = 1, i = 0 }
) → AnimNation.Spring
Adds a custom spring to the AtomicPane, which will automatically bind to the
_draw function and be available in the _springs table.
AddSprings
AtomicPane:AddSprings(springs: table,--
The list of spring names to add
info: table--
The spring parameters to define the initial spring values
) → ()
Adds multiple custom springs to the AtomicPane, which will automatically bind
to the _draw function and be available in the _springs table.
SetVisible
AtomicPane:SetVisible(isVisible: boolean,--
Whether to make it visible
doNotAnimate: boolean?--
Whether the transition is animated or instant
) → ()Sets the visibility of the AtomicPane.
Show
AtomicPane:Show(doNotAnimate: boolean?--
Whether the transition is animated or instant
) → ()Sets the visibility of the AtomicPane to true.
Hide
AtomicPane:Hide(doNotAnimate: boolean?--
Whether the transition is animated or instant
) → ()Sets the visibility of the AtomicPane to false.
Toggle
AtomicPane:Toggle(doNotAnimate: boolean?--
Whether the transition is animated or instant
) → ()Toggles the visibility of the AtomicPane.
IsVisible
AtomicPane:IsVisible() → boolean--
Whether the AtomicPane is currently visible
SetAlphaAnimationEnabled
AtomicPane:SetAlphaAnimationEnabled(enabled: boolean) → ()When enabled, forces a global override so that all Visible transitions are instant. It essentially makes doNotAnimate always true.