Thread Tools Display Modes
05-02-20, 05:32 PM   #1
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Cooldown frame not seeing cooldown animation?

This is my code i'm using to create a frame with a texture/cooldown frame attached.

Code:
local f = CreateFrame("FRAME")
f:SetWidth(32)
f:SetHeight(32)
f:SetPoint("CENTER")

local cdFrame = CreateFrame("Cooldown", nil, f)
cdFrame:SetAllPoints(f)
cdFrame:SetSwipeColor(1, 1, 1)

local texture = f:CreateTexture(nil, "BACKGROUND")
texture:SetAllPoints(f)
texture:SetTexCoord(0.07,0.9,0.07,0.90)
texture:SetTexture(132242)

f:Show()

cdFrame:SetCooldown(GetTime(), 10)
This is what I see.



Any idea why I cannot see the darkened cooldown area?

Last edited by MinguasBeef : 05-02-20 at 05:52 PM.
  Reply With Quote
05-02-20, 05:38 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
I have this set up for my mage portals addon and I am pretty sure I had the swipe stuff working on it.

Lua Code:
  1. -- Get the cooldown informaton and if it is just the general cooldown, don't bother
  2.     local cdStart, cdDuration, cdEnabled, cdRate = GetSpellCooldown(id)
  3.     local cdDrawEdge = false
  4.        
  5.     if cdDuration and cdDuration < 2 then return end
  6.  
  7.     button.Cooldown:SetEdgeTexture("Interface\\Cooldown\\edge");
  8.     button.Cooldown:SetSwipeColor(1, 1, 0.8);   >>>>>>>>>>>>>>> Missing this perhaps ?
  9.     button.Cooldown:SetHideCountdownNumbers(false);
  10.     button.Cooldown.currentCooldownType = COOLDOWN_TYPE_NORMAL;
  11.     button.Cooldown:SetCooldown(cdStart, cdDuration)
  12.     button.Cooldown:Show()
__________________
  Reply With Quote
05-02-20, 05:52 PM   #3
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Originally Posted by Xrystal View Post
I have this set up for my mage portals addon and I am pretty sure I had the swipe stuff working on it.

Lua Code:
  1. -- Get the cooldown informaton and if it is just the general cooldown, don't bother
  2.     local cdStart, cdDuration, cdEnabled, cdRate = GetSpellCooldown(id)
  3.     local cdDrawEdge = false
  4.        
  5.     if cdDuration and cdDuration < 2 then return end
  6.  
  7.     button.Cooldown:SetEdgeTexture("Interface\\Cooldown\\edge");
  8.     button.Cooldown:SetSwipeColor(1, 1, 0.8);   >>>>>>>>>>>>>>> Missing this perhaps ?
  9.     button.Cooldown:SetHideCountdownNumbers(false);
  10.     button.Cooldown.currentCooldownType = COOLDOWN_TYPE_NORMAL;
  11.     button.Cooldown:SetCooldown(cdStart, cdDuration)
  12.     button.Cooldown:Show()
I've updated my code, but I still get the same behavior.
  Reply With Quote
05-02-20, 06:15 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Any reason you're not using the CooldownFrameTemplate?

Lua Code:
  1. local f = CreateFrame("FRAME")
  2. f:SetWidth(32)
  3. f:SetHeight(32)
  4. f:SetPoint("CENTER")
  5.  
  6. local cdFrame = CreateFrame("Cooldown", "MyCdFrame", f,  "CooldownFrameTemplate")
  7. cdFrame:SetAllPoints(f)
  8. cdFrame:SetSwipeColor(1, 1, 1)
  9.  
  10. local texture = f:CreateTexture(nil, "BACKGROUND")
  11. texture:SetAllPoints(f)
  12. texture:SetTexCoord(0.07,0.9,0.07,0.90)
  13. texture:SetTexture(132242)
  14.  
  15. f:Show()
  16.  
  17. MyCdFrame:SetCooldown(GetTime(), 10)

Code:
/run MyCdFrame:SetCooldown(GetTime(), 10)
to play it over.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
05-02-20, 06:25 PM   #5
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Originally Posted by Fizzlemizz View Post
Any reason you're not using the CooldownFrameTemplate?

Lua Code:
  1. local f = CreateFrame("FRAME")
  2. f:SetWidth(32)
  3. f:SetHeight(32)
  4. f:SetPoint("CENTER")
  5.  
  6. local cdFrame = CreateFrame("Cooldown", "MyCdFrame", f,  "CooldownFrameTemplate")
  7. cdFrame:SetAllPoints(f)
  8. cdFrame:SetSwipeColor(1, 1, 1)
  9.  
  10. local texture = f:CreateTexture(nil, "BACKGROUND")
  11. texture:SetAllPoints(f)
  12. texture:SetTexCoord(0.07,0.9,0.07,0.90)
  13. texture:SetTexture(132242)
  14.  
  15. f:Show()
  16.  
  17. MyCdFrame:SetCooldown(GetTime(), 10)

Code:
/run MyCdFrame:SetCooldown(GetTime(), 10)
to play it over.
Ah, this was the issue! Thanks!

I was porting some old stuff that was compatible with the 2.4.3 client and it did not use that template. I didn't even know about it. Ty!
  Reply With Quote
05-02-20, 09:11 PM   #6
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Rofl .. I totally missed the missing template .. I have that in my xml code for my frame.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Cooldown frame not seeing cooldown animation?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off