Skip to main content
The Region Prototype provides the foundation for all WeakAuras display regions (Icon, Text, Progress Texture, Model, etc.). All region types inherit these base methods and properties.

Position and Anchoring

SetAnchor

Sets the anchor point and relative frame for the region.
region:SetAnchor(anchorPoint, relativeTo, relativePoint)
anchorPoint
string
required
Anchor point on the region (“CENTER”, “TOPLEFT”, etc.)
relativeTo
frame
required
Frame to anchor relative to
relativePoint
string
required
Anchor point on the relative frame

SetOffset

Sets the X and Y offset from the anchor point.
region:SetOffset(xOffset, yOffset)
xOffset
number
required
Horizontal offset in pixels
yOffset
number
required
Vertical offset in pixels

GetXOffset / GetYOffset

Returns the current offset values.
local x = region:GetXOffset()
local y = region:GetYOffset()
offset
number
The offset value in pixels

SetOffsetRelative

Sets relative offset (used by animations and conditions).
region:SetOffsetRelative(xOffsetRelative, yOffsetRelative)
xOffsetRelative
number
required
Relative X offset
yOffsetRelative
number
required
Relative Y offset

UpdatePosition

Updates the region’s position based on current anchor and offset values.
region:ReAnchor()

ResetPosition

Resets all position information.
region:ResetPosition()

Alpha and Transparency

SetRegionAlpha

Sets the base alpha value for the region.
region:SetRegionAlpha(alpha)
alpha
number
required
Alpha value (0.0 to 1.0)

GetRegionAlpha

Returns the current effective alpha.
local alpha = region:GetRegionAlpha()
alpha
number
Current alpha value (0.0 to 1.0)

SetAnimAlpha

Sets the animation alpha (multiplied with region alpha).
region:SetAnimAlpha(alpha)
alpha
number
required
Animation alpha value (0.0 to 1.0)

Progress Sources

SetProgressSource

Sets the progress source for the region.
region:SetProgressSource(progressSource)
progressSource
table
required
Progress source configuration:
  • [1] - Trigger number (-2=parent auto, -1=auto, 0=manual, >0=specific trigger)
  • [2] - Type (“timer”, “elapsedTimer”, “number”)
  • [3] - Property name for value
  • [4] - Property name for total/duration
  • [5] - Property name for inverse flag
  • [6] - Property name for paused flag
  • [7] - Property name for remaining time
  • [8] - Use additional progress overlays

GetProgressSource

Returns the current progress source configuration.
local progressSource = region:GetProgressSource()

SetAdjustedMin / SetAdjustedMax

Sets minimum/maximum bounds for progress.
region:SetAdjustedMin("10")      -- Absolute value
region:SetAdjustedMin("10%")     -- Percentage of total
region:SetAdjustedMax("90%")
value
string
required
Minimum/maximum value (number or percentage)

GetMinMaxProgress

Returns the current progress bounds.
local min, max = region:GetMinMaxProgress()
min
number
Minimum progress value
max
number
Maximum progress value

UpdateProgress

Updates the progress display based on current state.
region:UpdateProgress()

Actions

SoundPlay

Plays a sound with the given options.
region:SoundPlay(options)
options
table
required
Sound options:
  • sound_type - “Play”, “Loop”, or “Stop”
  • sound - Sound file path or ” custom” or ” KitID”
  • sound_path - Custom sound file path
  • sound_kit_id - Sound kit ID
  • sound_channel - Audio channel (“Master”, “SFX”, etc.)
  • sound_repeat - Repeat interval for loops
  • sound_fade - Fade out duration for stops

SoundStop

Stops the currently playing sound.
region:SoundStop(fadeoutTime)
fadeoutTime
number
Fade out duration in milliseconds

SendChat

Sends a chat message with the given options.
region:SendChat(options)
options
table
required
Chat options:
  • message_type - “PRINT”, “WHISPER”, “CHANNEL”, etc.
  • message - Message text with formatters
  • message_dest - Destination (player name or channel)
  • message_channel - Channel number
  • r, g, b - Text color
  • message_custom - Custom function
  • message_formaters - Formatter configuration

RunCode

Runs custom Lua code.
region:RunCode(func)
func
function
required
Function to execute in the aura environment

GlowExternal

Applies a glow effect to an external frame.
region:GlowExternal(options)
options
table
required
Glow options:
  • glow_type - Type of glow effect
  • glow_anchor - Anchor point
  • glow_frame - Target frame
  • Additional glow-specific parameters

Sub-Regions

AnchorSubRegion

Anchors a sub-region (text, glow, etc.) to the main region.
region:AnchorSubRegion(subRegion, anchorType, anchorPoint, selfPoint, anchorXOffset, anchorYOffset)
subRegion
frame
required
The sub-region frame to anchor
anchorType
string
required
“point” or “area”
anchorPoint
string
required
Anchor point on the region or “sub.N.key” for sub-region anchoring
selfPoint
string
required
Anchor point on the sub-region
anchorXOffset
number
X offset
anchorYOffset
number
Y offset

Lifecycle Methods

Expand

Shows the region with start animations.
region:Expand()
This method:
  1. Calls PreShow() if defined
  2. Shows the region
  3. Runs start actions
  4. Plays start animations
  5. Notifies parent (for groups)

Collapse

Hides the region with finish animations.
region:Collapse()
This method:
  1. Calls PreHide() if defined
  2. Runs finish actions
  3. Plays finish animations
  4. Hides the region
  5. Stops looping sounds
  6. Notifies parent (for groups)

Update

Updates the region based on current state.
region:Update()
Typically calls:
  • UpdateProgress() - Update progress display
  • Region-specific update logic (icon, text, etc.)

Tick

Called every frame when region needs per-frame updates.
region:Tick()

UpdateTick

Enable or disable per-frame updates.
region:UpdateTick()

State Management

Regions track their current state:
region.state       -- Current trigger state (primary)
region.states      -- All trigger states (indexed by trigger number)
region.id          -- Aura ID
region.cloneId     -- Clone ID (for dynamic groups)
region.toShow      -- Whether region should be visible

Sub-Region Events

Regions provide an event system for sub-regions:
-- Subscribe to events
region.subRegionEvents:AddSubscriber("eventName", subscriber)

-- Unsubscribe
region.subRegionEvents:RemoveSubscriber("eventName", subscriber)

-- Notify subscribers
region.subRegionEvents:Notify("eventName", ...)

Available Events

  • "AlphaChanged" - Alpha value changed
  • "UpdateProgress" - Progress updated
  • "FrameTick" - Per-frame update
  • "PreShow" - Before region shows
  • "PreHide" - Before region hides

Examples

Custom Position Animation

-- Animate position relative to base
for offset = 0, 100, 5 do
  C_Timer.After(offset * 0.01, function()
    region:SetOffsetRelative(offset, 0)
  end)
end

Progress with Adjusted Bounds

-- Show only middle 80% of progress
region:SetProgressSource({-1, ""})  -- Auto source
region:SetAdjustedMin("10%")
region:SetAdjustedMax("90%")
region:UpdateProgress()

Multi-Trigger Progress

-- Use trigger 2 for progress
region:SetProgressSource({
  2,                    -- Trigger number
  "timer",              -- Progress type
  "expirationTime",     -- Time property
  "duration",           -- Duration property
  "inverse",            -- Inverse flag property
  "paused",             -- Paused flag property
  "remaining",          -- Remaining property
  true                  -- Use additional progress
})

Sound with Looping

region:SoundPlay({
  sound_type = "Loop",
  sound = "Interface\\AddOns\\WeakAuras\\Media\\Sounds\\AirHorn.ogg",
  sound_channel = "Master",
  sound_repeat = 2.0  -- Loop every 2 seconds
})

-- Stop when done
region:SoundStop(1000)  -- 1 second fade out

Sub-Region Anchoring

-- Anchor text to top of icon
region:AnchorSubRegion(
  textSubRegion,
  "point",
  "TOP",
  "BOTTOM",
  0,
  -5
)

-- Anchor to another sub-region
region:AnchorSubRegion(
  subRegion2,
  "point",
  "sub.1.BOTTOM",  -- Anchor to first sub-region's bottom
  "TOP",
  0,
  0
)

See Also

Build docs developers (and LLMs) love