Forked from Meorawr/PrivateAuras_AuraAnchorExample.lua
Created
April 22, 2024 13:49
-
-
Save RA80533/8f533c5456fcbeda0bce496ce1712489 to your computer and use it in GitHub Desktop.
Private Auras API Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This example will configure an anchor to display the first private aura that | |
-- gets applied to the player. | |
-- | |
-- Multiple calls for the same aura index can be made. This will in effect | |
-- create multiple distinct displays for the same aura index. | |
local AuraFrame1 = CreateFrame("Frame", UIParent); | |
AuraFrame1:SetPoint("CENTER"); | |
AuraFrame1:SetSize(48, 48); | |
AuraFrame1.Background = AuraFrame1:CreateTexture(nil, "BACKGROUND"); | |
AuraFrame1.Background:SetAllPoints(AuraFrame1); | |
AuraFrame1.Background:SetColorTexture(0.5, 0, 1); | |
local auraAnchor = { | |
unitToken = "player", | |
auraIndex = 1, | |
-- The parent frame of an aura anchor must have a valid rect with a non-zero | |
-- size. Each private aura will anchor to all points on its parent, | |
-- providing a tooltip when mouseovered. | |
parent = AuraFrame1, | |
-- An optional cooldown spiral can be configured to represent duration. | |
showCountdownFrame = true, | |
showCountdownNumbers = true, | |
-- An optional icon can be created and shown for the aura. Omitting this | |
-- will display no icon. | |
iconInfo = { | |
iconWidth = 32, | |
iconHeight = 32, | |
iconAnchor = { | |
point = "CENTER", | |
relativeTo = AuraFrame1, | |
relativePoint = "CENTER", | |
offsetX = 0, | |
offsetY = 0, | |
}, | |
}, | |
-- An optional icon duration fontstring can also be configured. | |
durationAnchor = { | |
point = "BOTTOM", | |
relativeTo = AuraFrame1, | |
relativePoint = "BOTTOM", | |
offsetX = 0, | |
offsetY = 0, | |
}, | |
} | |
-- Anchors can be removed (and the aura hidden) via the RemovePrivateAuraAnchor | |
-- API, passing it the anchor index returned from the Add function. | |
local anchorIndex = C_UnitAuras.AddPrivateAuraAnchor(auraAnchor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- An anchor for warning text (basically raid alerts) can be configured as | |
-- well. Unlike aura anchors this is a global resource - there is only one | |
-- warning text anchor to configure. | |
C_UnitAuras.SetPrivateWarningTextAnchor(UIParent, { | |
point = "TOP", | |
relativeTo = UIParent, | |
relativePoint = "TOP", | |
offsetX = 0, | |
offsetY = 0, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment