Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Advertisement
API Cooldown SetCooldown

Cooldown animation

Shows a cooldown animation on a cooldown frame.

obj:SetCooldown(start, duration[, modRate])

Arguments[]

start
Number - The time when the cooldown started (as returned by GetTime()). Zero if no cooldown.
duration
Number - Cooldown duration in seconds. Zero if no cooldown.
modRate
Number - The rate at which the animation should be updated.

Details[]

  • Calling this method will automatically show/hide the Cooldown widget. The widget, unless the animation is reversed, will also hide itself automatically when the animation completes.

Examples[]

First we create a container frame, a texture and a cooldown frame to work with:

local myFrame = CreateFrame("Frame", nil, UIParent)
myFrame:SetSize(80, 80)
myFrame:SetPoint("CENTER")
local myTexture = myFrame:CreateTexture()
myTexture:SetAllPoints()
myTexture:SetTexture("Interface\\Icons\\Ability_Druid_TreeofLife")
local myCooldown = CreateFrame("Cooldown", "myCooldown", myFrame, "CooldownFrameTemplate")
myCooldown:SetAllPoints()

Then we display a 10s cooldown animation on the cooldown frame:

myCooldown:SetCooldown(GetTime(), 10)

To display a 20s cooldown animation which started 5s ago:

myCooldown:SetCooldown(GetTime() - 5, 20)

To reset the cooldown animation and trigger the "cooldown finished" bling:

myCooldown:SetCooldown(0, 0)

To set the animation according to a cooldown of a spell in the spellbook we use:

local start, duration = GetSpellCooldown("Spell Name")
myCooldown:SetCooldown(start, duration)

Patch changes[]

  • Legion Patch 7.1.0 (2016-10-25): The modRate argument was added.
  • Warlords of Draenor Patch 6.0.2 (2014-10-14): The charges and maxCharges arguments were removed.
  • Mists of Pandaria Patch 5.1.0 (2012-11-27): This function now also manages the visibility of the widget it is called on.
  • Mists of Pandaria Patch 5.0.4 (2012-08-28): The third argument, drawEdgeOnly was replaced by charges and maxCharges arguments.

See Also[]

Advertisement